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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
) }  p3 g0 J- Y6 w1 v- X$ j
  1. [code]EDMA sample test application
    1 u, e! H6 H  v3 c% |
  2. /*$ a4 F" x+ N1 I( o7 ]; x) y
  3. * edma_test.c8 _1 m2 X* W# F+ E; N, P
  4. *" j3 E& ]! c7 Q. f, Q) T1 s
  5. * brief  EDMA3 Test Application
    ) A, b* n4 V' c7 Q
  6. *
    - J; E- w$ E2 c3 S' T. A
  7. *   This file contains EDMA3 Test code.4 e/ Z$ G* H+ ^4 k/ |( p% x
  8. *, u+ j$ C+ n( E, }% S
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    ! b2 K' Q# L5 \5 M6 b! b; w
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT' U  N& R/ L8 \
  11. *         TO CHANGE.
    * q. b. K; J0 M5 t( \4 z' A# g. c
  12. *  ~1 C' l& {- x. Y3 ?
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    " p( }- k- Z& s2 K
  14. *
    5 I, P* D3 f! X- t' T4 A. ]
  15. * This program is free software; you can redistribute it and/or6 |& S/ ]  K5 u
  16. * modify it under the terms of the GNU General Public License as/ j, y# f2 I1 C) }$ d& G& t! T8 W
  17. * published by the Free Software Foundation version 2., ~* W( z+ E0 K( y- j6 o6 `. ~
  18. *
    + `4 Q7 y7 ]9 }/ ]
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    9 ]% w' F! Z- L- \9 X: K
  20. * kind, whether express or implied; without even the implied warranty+ P# P1 x& M6 ^3 r4 @* a8 M
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    9 K* F2 d9 W! G
  22. * GNU General Public License for more details.
    / k) z; {% x% x1 l
  23. */
    2 A$ n- I, S/ f! d, v
  24. 9 C' j+ G- S5 g2 P1 {
  25. #include <linux/module.h>4 G2 g8 |2 o; b; S- ]4 P$ T# v$ e
  26. #include <linux/init.h>
    * a) b3 L  [" s) e; ~$ `% B2 H3 P5 U
  27. #include <linux/errno.h>
    $ x3 B; F$ J1 f4 H1 h) m
  28. #include <linux/types.h>% ^9 I/ @$ }7 e! C8 o( v5 {
  29. #include <linux/interrupt.h>
    " `( W9 `: P* d  |
  30. #include <asm/io.h>
    4 t5 v: r7 ?, }- C
  31. #include <linux/moduleparam.h>
    % f- Y/ ~9 l4 L
  32. #include <linux/sysctl.h>1 {6 |. [& Z% d8 q+ F
  33. #include <linux/mm.h>
    % A* y. A- a5 a+ y
  34. #include <linux/dma-mapping.h>( T) j$ P. d& L/ X; I
  35. ) R  Q; f$ ]; l& h
  36. #include <mach/memory.h>4 ~1 t( ^* j& s  O5 w2 ]5 ?
  37. #include <mach/hardware.h>
    , O4 H  i. r( N$ t
  38. #include <mach/irqs.h>& z- D- Q3 p$ R- b
  39. #include <asm/hardware/edma.h>8 ~3 S# j9 V+ U$ [- b1 z7 i
  40. . a* L9 K. c4 r1 w  ]+ m/ J% |% Y6 ]
  41. #undef EDMA3_DEBUG/ _% \, F- t2 N6 [- E2 V
  42. /*#define EDMA3_DEBUG*/
    % l- F4 l  u# {# m# Z) c  u7 W
  43. % J2 F0 U  i( l, k- D  S, i2 x" W
  44. #ifdef EDMA3_DEBUG
    & W. ~9 ~9 T* T& j2 d. K
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    ( c. z( w  B/ u, I) f
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    ' d! O) h! M' S4 e% s: U* ^5 ~  ^7 n6 h
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)2 j" A# t6 f+ ]; L4 B
  48. #else
    ' Y, n1 x# _2 e0 Z7 y
  49. #define DMA_PRINTK( x... ), v' ^7 w6 R- l5 s) A
  50. #define DMA_FN_IN
    9 p* V3 c  [# i/ p9 X3 p5 P& u
  51. #define DMA_FN_OUT
    . q5 |' W" W7 ]& E
  52. #endif; D0 T# }, @: l  [$ y& _
  53. 1 R) Z5 A1 E; b' N4 N
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)4 _  J6 x! U3 d
  55. #define STATIC_SHIFT                34 _* o3 W# t4 M) t, m
  56. #define TCINTEN_SHIFT               20
    7 i4 ~4 n( u9 V' j$ h/ ]
  57. #define ITCINTEN_SHIFT              21& k7 K. T" f9 k$ o# k
  58. #define TCCHEN_SHIFT                222 x7 y6 t, F( L" [; N" p8 F$ W
  59. #define ITCCHEN_SHIFT               239 Y$ j9 k% j8 f! z/ P+ P
  60. ' f3 X& D2 ^. H8 }" n+ m, I
  61. static volatile int irqraised1 = 0;
    3 c9 @* ~6 _3 V2 x
  62. static volatile int irqraised2 = 0;
    ( p5 c! ^. j& P' R$ }) d) e" s

  63. 2 L  n- a: Z, K$ C/ j
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
      e0 ]* ]' b. R* w4 [- D
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    - I: f. M" T) P& p
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
      K9 n" u; v! o1 q/ `
  67. / I  ?0 b9 Q' ]8 u% H- t' F8 `
  68. dma_addr_t dmaphyssrc1 = 0;
    : d. w& c& G- @  ]' Z
  69. dma_addr_t dmaphyssrc2 = 0;
    : Q9 m0 V" ^2 O, b8 _1 i# P2 p* p  i
  70. dma_addr_t dmaphysdest1 = 0;  Z3 y/ M* i3 ~$ z& A0 g' B* ~
  71. dma_addr_t dmaphysdest2 = 0;. z6 ?* u7 v) d# x8 S4 ~7 m
  72. . t) M% |2 g1 [
  73. char *dmabufsrc1 = NULL;8 F' u' {: b. J+ ~
  74. char *dmabufsrc2 = NULL;+ o/ x7 I0 p' a0 K
  75. char *dmabufdest1 = NULL;7 d$ ~  j& w+ K9 B
  76. char *dmabufdest2 = NULL;: Q( `. _* K8 u, Q& m6 x7 p

  77. 2 C, Z4 g6 P3 w" e! V% p0 R' b  X
  78. static int acnt = 512;
    : f' V6 E- O5 c* p6 s
  79. static int bcnt = 8;
    * G6 A2 ~" t5 N$ B7 Z  e4 d
  80. static int ccnt = 8;, P- y# Q8 Z: v, S
  81. $ t+ B" O2 H2 q' }+ t; n9 h
  82. module_param(acnt, int, S_IRUGO);$ u. r; k0 m+ g  w1 u$ M
  83. module_param(bcnt, int, S_IRUGO);
      E5 V6 ]+ D  g! x6 w) N0 A
  84. module_param(ccnt, int, S_IRUGO);
复制代码
3 b% ~& I- A% N( f( Z) v3 L' z% h+ O; y

+ A$ r' f+ t$ E8 j* K* G1 K      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用& n/ q! D( T# r% 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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。& |: ]% [  _% X- @4 }5 ?0 T
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
. M  k( t# S1 X  \5 {3 q! q2 j$ q: V+ `* ^. B1 R

' v/ t0 [8 K* q% Q0 |, q& Z
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-2-25 04:47 , Processed in 0.039563 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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