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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |正序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 & q$ u7 t* [/ V& [# q
  1. [code]EDMA sample test application
    9 a! W9 y) w0 y  U
  2. /*3 @- j* `8 u! |* h& W
  3. * edma_test.c
    4 n" i# g: w1 Y3 a' e
  4. *
    6 F; }5 b( y% p6 P
  5. * brief  EDMA3 Test Application
    + y! X( d( A; A
  6. *
    * V9 p  x0 F" |/ O5 w& K- ^. b7 Z* l
  7. *   This file contains EDMA3 Test code.
    1 F4 L/ s7 J+ C  Z
  8. *9 p1 J, T7 r0 ?: o. B
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE/ B, P9 F; q; ~" W
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT" A8 q5 r& B9 N/ p% ?
  11. *         TO CHANGE.
    : T& t# O/ }: _! z/ j5 d! B$ {6 u! ?
  12. *
    - C, L# S0 @& w8 m" M0 y' {
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/: N" Y3 L) V# S1 {/ M5 B
  14. *
    ! {: Z, ?$ P' m: L5 u
  15. * This program is free software; you can redistribute it and/or
    0 L. u) C, v. r: |9 w
  16. * modify it under the terms of the GNU General Public License as; T$ Z) o) ]* X/ `2 ^6 {0 S+ ?
  17. * published by the Free Software Foundation version 2.
    4 J& K) M  a4 p; C/ [3 M! s
  18. *+ Q% {0 A% `" b/ k
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any/ D4 N0 s- {' O8 I
  20. * kind, whether express or implied; without even the implied warranty
      \' [8 [( h/ e" A
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    8 ?7 J4 r7 h: n* ]
  22. * GNU General Public License for more details.
    ! u/ ?5 C( _9 W2 K/ P3 I
  23. */
    & Y5 p/ p' z+ d- o2 o( l4 w

  24. & x6 |0 A& v& S4 I
  25. #include <linux/module.h>
    8 @0 N2 D) }7 O$ ~
  26. #include <linux/init.h>
    , b0 G, ^  G+ n5 S. X$ c
  27. #include <linux/errno.h>
    1 F( }# s$ Z) h
  28. #include <linux/types.h>
    ; u, I: |" J* e
  29. #include <linux/interrupt.h>
    5 ]( X9 s' D  N* `
  30. #include <asm/io.h>5 }6 f3 v6 `, G! R6 \5 n& z
  31. #include <linux/moduleparam.h>1 ~' n* N9 A% I3 ~
  32. #include <linux/sysctl.h>; _3 t1 H  ]1 ~
  33. #include <linux/mm.h>
    6 n! }# j3 R2 m2 S0 H  Y: Q, W
  34. #include <linux/dma-mapping.h>! S" D2 S1 @; l' y
  35. ' |3 A; J) \2 m
  36. #include <mach/memory.h>
    ( o1 k8 X# i% b. ^" e( I
  37. #include <mach/hardware.h>
    3 |$ Z9 C( Z, [0 F4 \! i* d
  38. #include <mach/irqs.h>/ |$ j! u7 o: \" F$ H
  39. #include <asm/hardware/edma.h># r3 k6 N  M5 B) Y9 ?

  40. % m( {5 g7 k* ~+ k, _# U0 C- i! C
  41. #undef EDMA3_DEBUG
    # a; ~& `, k# F+ _( W, y
  42. /*#define EDMA3_DEBUG*/
    , O( U# R8 I% @! Z0 b
  43. 5 {$ T3 g0 B# k/ E
  44. #ifdef EDMA3_DEBUG8 N! p9 y" I, y4 ^) \# |
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)+ p' |% @6 [$ S9 w) A  h5 W/ g* T
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)1 @+ M3 G. W* g- X& H; F, x' a# h
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)$ \7 m! O! v" x
  48. #else) h4 O$ z& a  [
  49. #define DMA_PRINTK( x... )
    5 c; l( P1 Q( Y8 V, C
  50. #define DMA_FN_IN1 j$ U4 I, }! }& ~9 J5 z
  51. #define DMA_FN_OUT
    ! ^. Q" D% }9 d6 a  f
  52. #endif: h% P; W4 y0 j( S6 \

  53. 7 W6 w+ e. A+ n( e; ~
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)' p) \0 Q7 f! E9 O
  55. #define STATIC_SHIFT                3
    2 N: G8 [. y. w: R# s( ], a! b
  56. #define TCINTEN_SHIFT               20! j/ _1 |+ t5 Y
  57. #define ITCINTEN_SHIFT              21
    ( J" Q: G, H" Z* _; Z% ]/ X
  58. #define TCCHEN_SHIFT                22+ j- N; C* y; ]6 Q2 _/ Z+ A2 p/ _
  59. #define ITCCHEN_SHIFT               23
    9 l, y0 H* k/ L* v

  60.   ^5 ~) _: F0 N! h
  61. static volatile int irqraised1 = 0;
    & x' ?' z4 F6 R* N1 U+ Q6 J
  62. static volatile int irqraised2 = 0;, ~$ D  e6 J. i& J, \1 U8 e

  63. ; |5 I, C$ t" @$ S6 u
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    - X$ L  H* c( \3 C6 m
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);5 w0 [% J6 t2 E5 _  }( \
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    , C/ C( i5 C; K$ L' m

  67.   x' l& @4 |, Z! r' R6 ?
  68. dma_addr_t dmaphyssrc1 = 0;6 K2 f0 Y$ W' \8 e+ M: ~* [
  69. dma_addr_t dmaphyssrc2 = 0;
    " @# i; ~) f4 I' S$ W+ b/ D
  70. dma_addr_t dmaphysdest1 = 0;' c* S" H; d. |1 f$ v6 v$ i  N
  71. dma_addr_t dmaphysdest2 = 0;
    ! ~/ N( C* J3 m3 b! o2 Q

  72. / B7 ~4 ^5 C. _, |: N% g
  73. char *dmabufsrc1 = NULL;4 ~1 j& U! S, g" X7 ~
  74. char *dmabufsrc2 = NULL;
    & |! T; {  g4 A% g% S) d
  75. char *dmabufdest1 = NULL;+ @" l' y* m; v  D, k; Q
  76. char *dmabufdest2 = NULL;. b$ c) o4 p  |
  77. ' s# ^; G, c$ z
  78. static int acnt = 512;8 Z3 D" a1 j4 C0 S7 N" R( e5 s# v
  79. static int bcnt = 8;, o4 N! c4 D7 {8 w* h) `8 J  d
  80. static int ccnt = 8;
    # [$ R* d. @. l% ?+ J
  81. / c# J5 x+ n; ?) h
  82. module_param(acnt, int, S_IRUGO);
    2 ]; X3 L( w3 f  v4 {% |! c# p
  83. module_param(bcnt, int, S_IRUGO);
    $ ?8 D$ @. Y' s9 a
  84. module_param(ccnt, int, S_IRUGO);
复制代码
  w$ m* y% q9 q* u, W; {

4 j9 h3 j7 \, M% A/ v      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用9 u# c7 B) x' _- y
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
+ v: k1 j0 K/ Z- p8 r     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。8 c9 t$ Y$ X2 K( D; w# z+ w
3 U& c8 l+ y, [
$ Q$ A3 O  e: j1 ~& g$ F  g: ^* K
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-2-24 04:14 , Processed in 0.041671 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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