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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 3 _$ |8 I4 b4 ?, p3 A2 V' F0 j
  1. [code]EDMA sample test application$ G' @8 X+ l- ~2 M( K( a
  2. /*
    ) y, V, D& B. A  y/ r0 s* Q
  3. * edma_test.c
    % Z" t& [7 d* U" j
  4. *
    , O8 ]/ n" g$ j/ v
  5. * brief  EDMA3 Test Application
    9 R' Z' p0 r$ h/ n
  6. *
    * j2 H& c, X8 V
  7. *   This file contains EDMA3 Test code.' Q' h0 N* }( l& Q: y7 ?) f
  8. ** r$ U# k; y. V  Z6 k  p0 {, i
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE/ B) f' X+ F4 m, [9 o6 P
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT* K: ?% V" i9 @+ Q
  11. *         TO CHANGE./ ~0 `2 F4 O# ]: n% ]) y
  12. *5 X; H8 ^, ~8 ?; u8 J9 ^
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/* W0 `6 r8 U( V, j" E
  14. *1 _/ ~, L/ A, o1 w0 A: J
  15. * This program is free software; you can redistribute it and/or& J1 ]  Y% V# x3 H7 c1 B8 F; K+ K
  16. * modify it under the terms of the GNU General Public License as4 I9 n4 q% K) S" g
  17. * published by the Free Software Foundation version 2.$ ?# g. }8 |2 p2 n% A! O
  18. *
    . E7 i% ]9 B6 Y- }: ~1 ?
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any  ?5 {- d8 A3 w2 e
  20. * kind, whether express or implied; without even the implied warranty
    & O0 ~8 A' W! ^; e+ l
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    " z: s4 x1 v5 w& c3 v/ e3 q; v
  22. * GNU General Public License for more details.
    : u4 q; B; D# `6 L6 Q; ^2 ?: x
  23. */0 d3 A' B& H; I, \
  24. " k+ m. q: i. {! K: l# H! G
  25. #include <linux/module.h>4 P1 Z# _3 s( J$ D4 Q' N2 ~
  26. #include <linux/init.h>
    * F  X9 o9 B* Y. K7 _( ]0 D+ y8 ~
  27. #include <linux/errno.h>- r) u& R1 N; I/ @' s
  28. #include <linux/types.h>
    8 y  R7 p, }3 l
  29. #include <linux/interrupt.h>
    2 W, _! M3 j9 I2 g8 v  [
  30. #include <asm/io.h>0 M, {* B- l( [- c. N; _
  31. #include <linux/moduleparam.h>1 L' `: f7 \* T* y7 m
  32. #include <linux/sysctl.h>4 o% r, \+ H! W/ b  i
  33. #include <linux/mm.h>( Y& X; U6 W! [& ^6 M
  34. #include <linux/dma-mapping.h>9 O* E- m0 i3 Q& O" [

  35. * k0 U. ^+ D" i4 k% H, p8 m
  36. #include <mach/memory.h>
    ; E% Y' @1 Y6 A9 T, S. S7 T
  37. #include <mach/hardware.h>
    2 T4 G& d8 Q7 R" N
  38. #include <mach/irqs.h>0 [& t5 I2 C9 A" L4 s
  39. #include <asm/hardware/edma.h>: Z# R0 v$ P0 i8 y/ U- z

  40. , e/ V+ {! C7 j- [
  41. #undef EDMA3_DEBUG, [5 j' {, `5 x* a
  42. /*#define EDMA3_DEBUG*/
    + M3 X, i; B" ?. y4 Q  F. @
  43. 6 x8 ~4 Q4 m. p/ O  ?- A. d& E& Z# o
  44. #ifdef EDMA3_DEBUG  Y- }. Y+ e! c! E$ E
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)9 O% F( Z/ D; V- }
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    8 ~% l$ a8 @  ?& Q+ X3 @. }! |
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__). c# z3 \' @- y% ^9 O
  48. #else
    # u1 t5 f, S! v
  49. #define DMA_PRINTK( x... )
    ! F1 g( b4 z4 @8 v- V
  50. #define DMA_FN_IN
    " v: U: r, n& d# I9 ~1 k1 @
  51. #define DMA_FN_OUT  @/ S7 q7 [! K) X; `. e- {; I
  52. #endif
    5 F' I/ z# I8 d$ x
  53. + _% ~2 o9 K2 c' \5 @9 B+ ^7 m  P
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    * q) i0 t6 V9 l7 R# m& R. b/ ~7 X7 C
  55. #define STATIC_SHIFT                3
    ( D( `8 {$ n5 O/ j
  56. #define TCINTEN_SHIFT               20+ w& f$ Z' W6 q5 U# M2 t
  57. #define ITCINTEN_SHIFT              21
    ' H, K7 X# X1 W
  58. #define TCCHEN_SHIFT                22
    7 R1 M) e% l4 Z$ f% f" _
  59. #define ITCCHEN_SHIFT               23! z, [7 ?, U" i' S7 p3 Q# ^

  60. $ h' H8 y. m! I+ y
  61. static volatile int irqraised1 = 0;" @( A: g' L" T0 [3 @
  62. static volatile int irqraised2 = 0;
    6 `3 \# u7 W0 Y8 H9 K
  63. 3 ?0 O7 u9 {* @0 X) Z
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    5 b; C, u* L  Y: c
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    + i6 f3 r) G3 _: f, |% j& p$ ], t
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    1 r, }; v! ?- p/ P3 I( P

  67. % N6 {' n' U6 h. i" O
  68. dma_addr_t dmaphyssrc1 = 0;  K5 R* ^! G3 o& C0 ?
  69. dma_addr_t dmaphyssrc2 = 0;
    ; ?! u; ?. b  F  I% Q$ B3 R
  70. dma_addr_t dmaphysdest1 = 0;
    + {; u* ^' |- l- t2 c- k6 G. J: c
  71. dma_addr_t dmaphysdest2 = 0;
    3 w7 E( j" b* B: Z* t0 A8 D4 N' r
  72. * Y6 t# T+ x1 O+ N) A
  73. char *dmabufsrc1 = NULL;
    " B$ z6 H% D; W+ t; k3 m
  74. char *dmabufsrc2 = NULL;  B* L! K  Q- |$ f
  75. char *dmabufdest1 = NULL;- U, c6 |! \& ?2 w
  76. char *dmabufdest2 = NULL;
    * S! b6 C  p1 g* t
  77. 4 x& `: z& U1 y8 {1 D
  78. static int acnt = 512;
    0 ~1 k: g3 [, B% \
  79. static int bcnt = 8;+ x; l6 S1 g* G5 R4 R  I, K$ Q+ Q6 o
  80. static int ccnt = 8;
    $ A7 w: T" s. z7 E4 H
  81. : `% D# v$ q& \
  82. module_param(acnt, int, S_IRUGO);! Y, P: S) ]1 p& h7 \; \& M2 Q
  83. module_param(bcnt, int, S_IRUGO);. e1 P, ~; B0 r3 u* M
  84. module_param(ccnt, int, S_IRUGO);
复制代码
- I* @- G2 {$ e% y- t
( I- @) Y5 n$ x0 j# \6 ^, i2 D
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用/ E( w5 ?1 t1 @! h$ k& G* K
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
2 R3 F$ G: |/ y. u+ `5 N+ O; Z     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
% w/ ?  q' o6 P2 C4 a5 K7 D/ r
$ z7 H; G* T- V3 E' J3 a6 G- D4 e3 F
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-10-29 20:22 , Processed in 0.052799 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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