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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 " y# V& t. b6 O6 g9 s2 q
  1. [code]EDMA sample test application
      B8 D2 y8 v$ c) e0 a
  2. /*
    $ A/ X9 T! s: C+ q+ p9 U; i
  3. * edma_test.c8 M% @" T8 u  p. C' l$ w4 c
  4. *
    9 R6 \, J+ Q# d8 I- @) t' e3 n
  5. * brief  EDMA3 Test Application
    9 I! |- n; `- \2 ^
  6. *
    0 f4 [) C0 T" t
  7. *   This file contains EDMA3 Test code.
    ( S. U( Y# c! A
  8. *$ ]( P# {; o% O" j" X
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE; v+ J& F1 k/ m4 y3 z, B" m; |
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT; P* }. S+ t. [+ J+ _
  11. *         TO CHANGE.
    9 L, O: J1 Y; m2 l7 m  q; \
  12. *
    ( F" u! u. d' S9 j
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/, V; O0 k2 I! s. q& J
  14. *+ F! E! h! H6 g5 M
  15. * This program is free software; you can redistribute it and/or
    9 U; r+ \% }2 A7 v* q) x# j
  16. * modify it under the terms of the GNU General Public License as0 \- p+ p2 E  U* o+ c& |7 E
  17. * published by the Free Software Foundation version 2.% Q3 S1 V/ Z% ?  [/ `1 t" K
  18. *
    5 H1 L% g% {1 U  H5 I0 @+ L
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    " i8 ~( T" d8 E* D0 b( a' e
  20. * kind, whether express or implied; without even the implied warranty
    ) \3 r- K/ S/ E% q. U0 c2 u
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the9 o. D1 G, Y2 |' i% U: X
  22. * GNU General Public License for more details.
    3 }2 }/ B% {% R- U! l9 S0 z
  23. */
    & g  d' S1 r" S# e

  24. 8 S# Y( s  i2 Q, s, S; d
  25. #include <linux/module.h>8 R# F9 ^7 [8 `6 m; ]
  26. #include <linux/init.h>
    : e& g5 V4 q+ V1 |  _
  27. #include <linux/errno.h>4 ^/ k  M% u( E2 K0 Z& k
  28. #include <linux/types.h>
      F2 b% G( R5 S$ d, ?
  29. #include <linux/interrupt.h>9 e1 Y; k" \; b, x
  30. #include <asm/io.h>7 U* A( L; A% D1 u
  31. #include <linux/moduleparam.h>! j1 Z6 x4 [7 M# u
  32. #include <linux/sysctl.h>
    ( v, M  N. }- m' ~# v' U1 {% e) v, R
  33. #include <linux/mm.h>
    6 X6 i/ w! |0 i  g# @* c! h
  34. #include <linux/dma-mapping.h>! S8 o: u2 N: U9 r( D) A2 Z! N
  35. * I$ B2 n+ g' O
  36. #include <mach/memory.h>: f: B) y1 W$ I+ k7 O5 M7 s; I
  37. #include <mach/hardware.h>
    + S( {8 V8 P, K) M$ N; u+ b/ X
  38. #include <mach/irqs.h>
      K1 N0 q! _/ z. U% d1 O1 H  v2 N
  39. #include <asm/hardware/edma.h>
    4 l1 \6 Z" Q" O1 ]1 l
  40. : A7 I1 @2 L- y& d+ P+ n; k
  41. #undef EDMA3_DEBUG
    * y8 I. ^7 Y0 S! B0 e2 P4 j
  42. /*#define EDMA3_DEBUG*/* d6 }/ Q5 g/ [3 l7 |

  43. ! Z7 i8 D$ z. C2 N7 Q
  44. #ifdef EDMA3_DEBUG
    . s, ?6 d+ v* f0 y
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)8 j% O0 v$ K, H- S5 L, n
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)' x4 j- K- \0 f2 K  ^, U- W& l  B
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)* I8 z$ c( W5 H/ u( D- l
  48. #else1 }/ V( m2 k1 M0 t5 e" l2 [
  49. #define DMA_PRINTK( x... )* p' ?4 F( n" _- X- H
  50. #define DMA_FN_IN
    , w9 g6 \  O+ N. p
  51. #define DMA_FN_OUT+ f2 A1 n5 A- V3 c" e
  52. #endif
    ; N$ A% O( `* [- p: i
  53. 3 [3 i) B8 V2 T' K
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)) f! e1 g/ ~# u
  55. #define STATIC_SHIFT                3% d0 p0 |  w! y; \8 b
  56. #define TCINTEN_SHIFT               20
    . T; ^7 r: G0 w$ s: p4 _
  57. #define ITCINTEN_SHIFT              21
    0 I! k  N7 J; x; B' G$ }7 T
  58. #define TCCHEN_SHIFT                22
    * ?3 O' F0 [6 Y9 C! p# ^( m! v, ~
  59. #define ITCCHEN_SHIFT               23
    $ f% ~4 v! P' V) @- }

  60. % {9 _0 l- \, y. G" O& \  X4 H
  61. static volatile int irqraised1 = 0;7 Z" k9 [, |. |# {
  62. static volatile int irqraised2 = 0;
    4 k, p" ]+ E- j- E0 |

  63. + ?1 T4 I  ?4 ^* w, X2 P0 f
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ! p, F3 c5 z' ^) d; m5 y
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);7 f: f7 T& \& _& S5 |" M" {
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);1 j: I$ v% b7 ]2 j0 p; c

  67. . \0 Z: j3 N# O, J$ E7 x0 d/ Y
  68. dma_addr_t dmaphyssrc1 = 0;
    ! d8 i6 V; ^# {, ?- u
  69. dma_addr_t dmaphyssrc2 = 0;
    $ J. f5 u# c/ c1 ~
  70. dma_addr_t dmaphysdest1 = 0;/ n" i# J- O$ W  j' O/ ^# I; m* g: W
  71. dma_addr_t dmaphysdest2 = 0;
      O  l& `' P: h4 Q
  72. ) O! s; e9 g% }. x4 o
  73. char *dmabufsrc1 = NULL;  r5 c1 S/ |/ }% x& f+ }, y
  74. char *dmabufsrc2 = NULL;
    ! H% \5 A1 z* z$ ?2 e; l9 U
  75. char *dmabufdest1 = NULL;
    6 g8 f8 g5 `* {" O2 I: C
  76. char *dmabufdest2 = NULL;8 b# v7 b" e4 X! x7 ^) J8 h6 B2 q
  77. ; V7 w) Y: T! W& x
  78. static int acnt = 512;
    9 k+ }4 G. u9 H1 r
  79. static int bcnt = 8;; j) B0 [( r) X8 t" V
  80. static int ccnt = 8;
    ( r5 N( d) R2 o+ F6 ?6 c% u! ~

  81. ' C* ^( b4 \) D/ E: a
  82. module_param(acnt, int, S_IRUGO);1 r- s' o/ B% @! B  E- g! x
  83. module_param(bcnt, int, S_IRUGO);2 d. L4 z' i" h0 t. @
  84. module_param(ccnt, int, S_IRUGO);
复制代码
. O+ B' q/ y4 O0 r
7 q0 }/ \) A4 _) p2 T! H
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用! V4 ]2 K  ^: z& o& q7 U3 W  _$ \0 J. l
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 ?! L; |8 m8 ^7 G- `! r7 O" U     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。  {5 E" J8 j4 x: @" w- D
. y$ q( I5 r' i  _/ f; l
0 g5 T, W& o* n+ w0 n$ L- A( A6 i
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-3-29 16:04 , Processed in 0.040932 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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