OMAPL138如何在Linux下使用EDMA3驱动 - OMAP-L138 - 嵌入式开发者社区 - 51ele.net
设为首页收藏本站

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |正序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
, a5 f3 B2 W9 X" \/ |) f
  1. [code]EDMA sample test application- b# ]+ X5 I! r
  2. /** I! l: r; A6 i8 q' u, T
  3. * edma_test.c
    , N( t. [% z" ?1 q& i/ k
  4. *
    # O2 b' Z* G0 ?  G2 G) @) V
  5. * brief  EDMA3 Test Application3 @" U4 {+ D' {
  6. *0 Y* H+ ^  ~; k7 R+ \7 l/ V6 c9 p+ K
  7. *   This file contains EDMA3 Test code.: ^; {; z) f) l* A1 v6 P" X& e8 [
  8. *
    : r8 s) |/ u0 V
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    $ M, t+ L! L7 N2 D6 y: {/ K0 b8 R% m
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    9 Z  l6 L. W  u
  11. *         TO CHANGE.
    + Z  B1 j0 A# T& g$ M" V7 R
  12. *! s4 g; n7 a4 q! g/ i/ v
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    " U/ k8 b5 f* X% j+ [1 \& H
  14. *2 ?; r. `( i( j, ]! R, L. l/ F
  15. * This program is free software; you can redistribute it and/or
    8 m4 ^1 N8 L6 {# J( R+ J7 h3 i
  16. * modify it under the terms of the GNU General Public License as
    # f/ O2 Z2 r( j1 k& U
  17. * published by the Free Software Foundation version 2.9 y) g+ c7 H4 h$ W; S6 R9 O
  18. *
    8 A; o# c) M) m% _' [
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any# c$ B4 `2 E5 ]( t
  20. * kind, whether express or implied; without even the implied warranty
    & ]. ~' \4 {2 p/ y/ f
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the1 d. @' u+ {  V4 i
  22. * GNU General Public License for more details.3 ?5 \: W2 H$ N3 r0 D' }0 I
  23. */) B  P! P! `7 i
  24. : m% `6 g- g  B0 }
  25. #include <linux/module.h>
    ! w$ R2 V/ C- y) x1 o: f
  26. #include <linux/init.h>
    ' [0 V2 ]: Y1 X5 j
  27. #include <linux/errno.h>. D: u1 _$ g7 M+ e+ k! r6 H( p
  28. #include <linux/types.h>
      A/ v8 j4 v9 Y
  29. #include <linux/interrupt.h>
    . D. k, u! B, ~( q" z! e
  30. #include <asm/io.h>% {8 {( W3 U: o8 U0 s9 E6 |
  31. #include <linux/moduleparam.h># ^7 P7 a9 D( K% S7 x* p- P
  32. #include <linux/sysctl.h>
    ) y: u9 X" K+ B+ W$ Q- x
  33. #include <linux/mm.h>  U% {, |5 |2 D) x& `+ m% r! H
  34. #include <linux/dma-mapping.h>
    1 z: H3 }0 z: G, ]. _: X
  35. ' C# A0 L  C  c: u
  36. #include <mach/memory.h>& r5 e* `" x6 V0 T
  37. #include <mach/hardware.h>
    9 e/ a! T& H1 B. I4 [
  38. #include <mach/irqs.h>% r5 q1 `( d3 s4 L
  39. #include <asm/hardware/edma.h>% u0 V3 @2 B8 L  ^7 `, E, |
  40. " y) [/ h- k3 b, }5 @2 W! }
  41. #undef EDMA3_DEBUG
    % q# H) m4 t2 U# Y; y0 }& i! I& v
  42. /*#define EDMA3_DEBUG*/4 `7 O; r9 Q9 s7 r

  43. 5 O0 O+ m4 q. {! E! E
  44. #ifdef EDMA3_DEBUG
    - }( D- t% e: b# V# j7 D( c7 J
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    % Z2 m- K6 i& v- \9 @
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    * \+ |. C. O5 s6 H+ u
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)8 D. P7 c# o/ ]
  48. #else
    # I/ \9 q) ]# a1 [$ Z# K
  49. #define DMA_PRINTK( x... )
    + X$ c$ K$ a! c" v; t( _+ T
  50. #define DMA_FN_IN; i3 B1 D- F2 R* g' |
  51. #define DMA_FN_OUT
    ; M& R1 H1 I7 [
  52. #endif
    / q4 K9 N: J1 x# g& n1 W
  53. ' ~3 T  \/ r2 Z6 s/ |5 P
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    * C7 k! g: P% `0 i
  55. #define STATIC_SHIFT                3
    # e1 Y: k7 a' i# A- X/ d4 S
  56. #define TCINTEN_SHIFT               20: u. r1 l% x+ k( |4 \! R
  57. #define ITCINTEN_SHIFT              21
    * }8 x$ @1 W0 g8 U( k+ `( A
  58. #define TCCHEN_SHIFT                22
    + f  E* G" ~5 w) X" W) c
  59. #define ITCCHEN_SHIFT               23: d0 ~# Q- G9 A" Z: t9 q

  60. , U, o8 p4 P7 @1 N' T
  61. static volatile int irqraised1 = 0;+ j7 I0 g- Z) ]% e* f
  62. static volatile int irqraised2 = 0;! V& ]& L. m& f4 x) U9 J+ G9 Q
  63. 7 m" l9 \1 }$ O* A, G
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);# F! o0 Y3 G% w/ ~6 Q& t: i: @2 u
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    * C! r: n" |. E# Z+ e3 @9 r. X
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    , e7 G' k' k% b' ]7 V+ P4 M9 R
  67. 1 o, j; L% T9 d6 S1 u+ Q
  68. dma_addr_t dmaphyssrc1 = 0;# ~6 _" ?, O) a2 @
  69. dma_addr_t dmaphyssrc2 = 0;
    ' Z  i5 K) `( Z2 y; B4 ^% T' ^
  70. dma_addr_t dmaphysdest1 = 0;
    ; _4 N1 c4 @4 f: u3 k; A+ M, y
  71. dma_addr_t dmaphysdest2 = 0;
    . f5 T0 ^  h& H/ [
  72. * R9 x# b" {9 ~3 B7 s7 B6 |
  73. char *dmabufsrc1 = NULL;
    ; D4 f* b/ t' }6 k! m/ W+ B$ n
  74. char *dmabufsrc2 = NULL;
    5 d! p: R! m3 x, C
  75. char *dmabufdest1 = NULL;
    2 z! B* a) s/ j: K5 n
  76. char *dmabufdest2 = NULL;
    # Y( [1 N) h: P0 B

  77. / X/ J" E: g7 Q; m5 b% h( ]
  78. static int acnt = 512;: R0 z5 Y' v, D4 ?% ?4 O, D
  79. static int bcnt = 8;
    6 n& [* o( J3 ~( c0 h% W$ S( w
  80. static int ccnt = 8;
    " Y; n/ y% I4 `1 ?  [$ g. N

  81. 9 f5 Z& O& D* n
  82. module_param(acnt, int, S_IRUGO);
    ) }$ T* F7 D$ b$ R: Z
  83. module_param(bcnt, int, S_IRUGO);9 X! l6 T' V! Q9 v7 M8 v5 m  Y
  84. module_param(ccnt, int, S_IRUGO);
复制代码

0 o# U* ]4 O4 e5 f& ~0 G7 ?8 U% |: ?7 w( A9 @* O( \7 j; r* R
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
6 T) t* m7 b. o/ T/ z0 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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
' n& x! A* s, F& _5 K     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。0 ~. B+ j/ D' N

4 D+ E& q- Z2 b$ o% r
- }  v, `) z, B, X* t$ T( P- ^# r! A6 l' ?
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-11-25 16:03 , Processed in 0.044964 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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