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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |正序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 / b4 q. B" y3 J
  1. [code]EDMA sample test application
    7 h3 K- t- P, Y5 P9 r/ v
  2. /*
    % I; ^- \; D+ v5 A
  3. * edma_test.c7 M3 R+ ?; [- {9 V& A
  4. *& U3 e9 N: m" \. ^, d+ e, q
  5. * brief  EDMA3 Test Application
    9 ~/ F5 V, c& A& d7 o* t
  6. *2 {% w" _- i! |
  7. *   This file contains EDMA3 Test code.$ J" _# u  T+ \' c$ J
  8. *
    ! m6 u4 o' y" }! l4 Q
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE' P' R+ @1 I% r5 [. k* [+ w9 d8 g
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    % p/ S! t5 T6 Q; H3 U+ n& U
  11. *         TO CHANGE.
    7 `3 a: D4 c1 U
  12. ** u9 s6 X0 @0 d3 j) d* v
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/9 D' O0 ^6 T/ I- n4 y  e, H
  14. *
    2 I; Z$ ]4 ?1 X7 f6 {  C" |8 o0 G
  15. * This program is free software; you can redistribute it and/or) {9 e1 n, v' k5 D; l1 P7 X
  16. * modify it under the terms of the GNU General Public License as
    - s8 `$ Y* y" I3 I
  17. * published by the Free Software Foundation version 2.
    ) J0 e7 Q6 [( ]% q7 ~+ z) X3 H
  18. *  _. B4 S) E. b6 ?
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any2 F6 e: A1 d6 Y/ ^8 c
  20. * kind, whether express or implied; without even the implied warranty3 j* C- Q4 S9 a
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the+ c! M$ ]) B0 Y
  22. * GNU General Public License for more details.% u! n6 f0 i/ @; k6 a$ a
  23. */! _7 n1 c# g# C( e8 S

  24. * p" @1 ?/ V4 C0 g4 X; B! i
  25. #include <linux/module.h>9 V9 k; I3 h* J1 g, k7 Z" @
  26. #include <linux/init.h>
    4 K9 h( c. F4 f! b% H- \0 v- B
  27. #include <linux/errno.h>3 W3 ]6 k0 c$ k( e* p6 y8 s
  28. #include <linux/types.h>
    ' H4 p5 b0 ]; Z: q
  29. #include <linux/interrupt.h>+ B. I1 B4 V3 @: e+ \7 C; F0 r+ e
  30. #include <asm/io.h>; K! x8 O# ]: t6 p$ E6 Q" L
  31. #include <linux/moduleparam.h>/ ]8 U4 m1 R% j# v+ Y1 N2 A$ U
  32. #include <linux/sysctl.h>
    . v2 g7 w$ `# T
  33. #include <linux/mm.h>  q9 |9 @9 m3 ]" G% f
  34. #include <linux/dma-mapping.h>
    $ f' {0 q, ?* V: Z7 W% L" Z$ K9 l
  35. # o6 w, V$ E, b9 u/ w) \6 Q6 x
  36. #include <mach/memory.h>5 H4 V. H9 ^# O% Z, f* r9 c
  37. #include <mach/hardware.h>
    - i! u) R6 k% w
  38. #include <mach/irqs.h>
    ( D/ d8 a7 L2 }4 i
  39. #include <asm/hardware/edma.h>1 c& `5 E1 Y% u3 E

  40. & a7 _: Z& q9 {0 i
  41. #undef EDMA3_DEBUG, o: I% I. ]+ K$ i' r
  42. /*#define EDMA3_DEBUG*/
    ; m, a1 I- [5 s! `, S
  43. 7 T' P" q9 r% M, H" _
  44. #ifdef EDMA3_DEBUG9 t4 B- N# V) G
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS). r6 o  C0 j  [9 b/ F/ ?! n
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)+ N6 f3 j- i) o1 S
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    ; s- W+ _9 h5 t% Z! k6 l! w
  48. #else
    $ S% v: z" t! H7 `1 C5 z1 A$ j
  49. #define DMA_PRINTK( x... )* B/ ~; N. W! J7 @- T8 R
  50. #define DMA_FN_IN
    9 r: r: y& q  k% L( ~
  51. #define DMA_FN_OUT
    0 R  E* X" m% P3 T! T7 i- j
  52. #endif
    - s* z5 A; P& n- E- s. c% g, M

  53. : ]6 a; q" B& K0 j( }
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)2 f) e6 \6 y: K- |& p3 Z
  55. #define STATIC_SHIFT                3
    9 J. p  r) s" |/ m' M
  56. #define TCINTEN_SHIFT               20
    . @" R' H- |5 k' C9 t. Y$ R
  57. #define ITCINTEN_SHIFT              21
    / G. O" K- C- f$ m, y6 E
  58. #define TCCHEN_SHIFT                22: q7 E: p2 f/ x' G: t
  59. #define ITCCHEN_SHIFT               23+ V; i1 x% b& S6 O# n! m! x5 \

  60. 5 ^* t, X. p; k7 J! H
  61. static volatile int irqraised1 = 0;" @0 g/ `. J" |& S* g
  62. static volatile int irqraised2 = 0;  y' v/ w. ?  t
  63. 9 \% H3 o8 F" R5 r: X& }
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ! e) C4 ]0 \9 L$ S) s0 K
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);( f# S( K# W3 w! a  v2 C" W
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    6 w; A7 @4 R/ Z8 ^/ j( c
  67. 6 n  A3 E8 m: g6 K' m
  68. dma_addr_t dmaphyssrc1 = 0;# i2 y+ w( p! \( S8 \6 _- g
  69. dma_addr_t dmaphyssrc2 = 0;9 @/ G3 u( u: T
  70. dma_addr_t dmaphysdest1 = 0;* N' ?. l6 I% w% U
  71. dma_addr_t dmaphysdest2 = 0;
    3 C6 Z  T' B% |

  72. , \* K) F% F, Z+ ~0 _5 B+ q# {
  73. char *dmabufsrc1 = NULL;- @& T; Q! Q- J* Y, f
  74. char *dmabufsrc2 = NULL;4 E- i# ~) ]2 G, z$ b1 d, U
  75. char *dmabufdest1 = NULL;
    ! c9 i1 i$ q9 u9 v3 ^
  76. char *dmabufdest2 = NULL;. m4 i/ d! f3 i2 I! L: G* c) o* I5 o) H
  77. 6 T) b9 d- a5 h% I% R* r
  78. static int acnt = 512;9 F. g6 Z4 Z( }' c" c
  79. static int bcnt = 8;
    % D' e* w7 i4 s( L& b% \% g( Z
  80. static int ccnt = 8;
    2 S; T  q( Z! \$ w1 ^
  81. # ~# I* a' j. j
  82. module_param(acnt, int, S_IRUGO);
    , k9 M1 F& Z# s7 f; s- ~. H
  83. module_param(bcnt, int, S_IRUGO);
    / ?- E1 J) l8 I) Y+ l2 p0 ]4 z  h6 e
  84. module_param(ccnt, int, S_IRUGO);
复制代码

6 f5 b5 o$ E" Z5 @; n
+ c* w7 U9 z- c- ]* n8 N( `      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用3 ~6 H2 A% M3 [5 M$ ^6 D) K5 T( ^; n0 T
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
- G" e( v/ q' X" ]     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
$ F4 o: _0 f0 L' J: I
+ c& @' F6 ^1 e( w5 E, u: y: A2 S- x% N2 y' s+ s3 C$ l/ L
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-1-15 11:47 , Processed in 0.041783 second(s), 27 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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