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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
' @$ }# O$ _; }- Y
  1. [code]EDMA sample test application
      p% p# D: F/ q2 y* Q
  2. /*
    % _7 M, V+ q: q/ T( f* q& b
  3. * edma_test.c
    + a: G1 M% l% A; f# F3 X+ b$ z
  4. *5 ]/ A6 [6 {6 A: O2 k1 o, T( L
  5. * brief  EDMA3 Test Application& _* M  \* k/ I. h0 ~( r* _
  6. *
    0 W  X7 v) k+ o9 Z
  7. *   This file contains EDMA3 Test code.1 _) G8 F% q. U- U# y2 L( Y' z
  8. *% V' t3 J7 |! c, L. N3 j
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    + D* T2 v) K9 G4 x1 n- R) r; F2 t
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    : M* }% g) I. ?! b, t- d$ Q
  11. *         TO CHANGE.
    4 V2 N5 V& c8 b, [$ q
  12. *
    * }$ p8 ~1 Y8 ?- d/ j
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/, d+ c6 Z  D* u0 g4 a
  14. *
    ! y1 R% M) e2 Q; `
  15. * This program is free software; you can redistribute it and/or* `- i$ ?) S1 d$ ^; o4 e* @9 v
  16. * modify it under the terms of the GNU General Public License as
    $ [& d. Q* t2 v1 k8 `2 D( }
  17. * published by the Free Software Foundation version 2.+ _4 I: B6 i$ Y; e- j
  18. *" G# o- ]* s0 J# K& E5 s
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any7 l/ C  H' ^4 |0 ~9 y, Q* e) Q) I
  20. * kind, whether express or implied; without even the implied warranty
    3 T8 \% t8 B2 y& e2 c
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the  \/ H4 {1 T% q( [$ p9 M# e! c
  22. * GNU General Public License for more details.
    $ i- x+ }$ o" M# R, F6 @, _8 d, P
  23. */
    2 ?% l2 F! N1 o4 W0 F8 ?- t
  24. 6 ]  [: n. ~, f- X% K, G
  25. #include <linux/module.h>
    ( D) ^% y! }- y7 B) a8 f0 m6 h
  26. #include <linux/init.h>
    , m+ J. i- f! N  Q
  27. #include <linux/errno.h>
    % N+ f3 }0 X. m, c7 X# v/ x0 S( t
  28. #include <linux/types.h>5 ^0 Y2 ^2 h/ X/ i, @# I9 e$ i- b
  29. #include <linux/interrupt.h>! p6 y3 T2 S/ [8 q; d  Q
  30. #include <asm/io.h># l4 B  N3 m1 w
  31. #include <linux/moduleparam.h>; s0 k1 h6 k/ \8 a+ ]7 F! y) G- Y2 C
  32. #include <linux/sysctl.h># Z3 }7 `$ i" ], f4 h' m$ o- ~
  33. #include <linux/mm.h>5 i# Y" f4 n6 c; `$ }
  34. #include <linux/dma-mapping.h>0 g/ c# M1 @& t6 a7 m
  35. 8 x) h# [8 t) N, t. a
  36. #include <mach/memory.h>1 `; p$ z# X1 ]6 Q5 C
  37. #include <mach/hardware.h>; x! W: Z% \5 F9 y
  38. #include <mach/irqs.h>
    ; O2 O( R* k# U$ B8 X  e& Z
  39. #include <asm/hardware/edma.h>
    0 j& f, C1 _- v. w9 h5 g8 L
  40. 0 L: y% k+ W# @8 C5 w0 F" p
  41. #undef EDMA3_DEBUG
    2 r0 @$ v% O2 Z* C1 X- k/ p* c
  42. /*#define EDMA3_DEBUG*// Q- {1 ~3 d+ a) i

  43. ! `$ F$ O1 E9 O$ N0 {
  44. #ifdef EDMA3_DEBUG
    - K) f- |& e0 B6 W
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)$ n* h) m/ |. u7 [. {
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)7 E- O# i3 M9 G- `# Y, `% j0 a+ a1 H; B
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    5 w+ a" u2 c7 p6 a
  48. #else5 [) }4 h, ]6 v+ q1 T5 D
  49. #define DMA_PRINTK( x... )
    / w( }7 M  I* p9 W" R
  50. #define DMA_FN_IN( V" z3 E- g) ?- i
  51. #define DMA_FN_OUT
    ; P& f' y! ?  n0 k" z
  52. #endif: W2 V) D* M9 r0 c8 F
  53. $ d3 J, r6 l! v; J
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    ; ?: B9 Y& r- ]. p! p" K
  55. #define STATIC_SHIFT                38 _( G: z4 p  D6 S' C! h3 r. @
  56. #define TCINTEN_SHIFT               20. N3 C. J4 \) S6 }) Y: d$ W
  57. #define ITCINTEN_SHIFT              21
    : V) U, i4 {- e
  58. #define TCCHEN_SHIFT                22
    & o4 S6 H, T! z
  59. #define ITCCHEN_SHIFT               23" A+ y& p9 z6 j- N  `5 ~
  60. / B  l4 F1 X5 w3 d% M. ]8 q/ M
  61. static volatile int irqraised1 = 0;7 g: c( ~9 a* m$ s0 ]$ s) Z" X
  62. static volatile int irqraised2 = 0;
      U3 B" h7 r# L9 B
  63. 6 c6 `8 S; C  a( G
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ) M4 H* p( x% B0 j
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    + z" l9 X2 N% k0 x* {
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);  e0 {& `* [; ^

  67. # p3 [7 s5 f! b1 N8 H
  68. dma_addr_t dmaphyssrc1 = 0;+ I6 E& X# i6 t4 y3 b' c; |
  69. dma_addr_t dmaphyssrc2 = 0;* Z" X4 a5 s1 O8 ?2 z4 k& k
  70. dma_addr_t dmaphysdest1 = 0;
    4 f5 d+ ]$ x+ r! d0 ?
  71. dma_addr_t dmaphysdest2 = 0;) t2 v; z# \, l5 L+ C$ q% O

  72. ' ?) [& D$ w  N4 S# x- a, F
  73. char *dmabufsrc1 = NULL;
    3 U/ A( \7 r( ^* z, R0 x
  74. char *dmabufsrc2 = NULL;" S$ _# h4 H8 K! ], s
  75. char *dmabufdest1 = NULL;
    2 |' @( `2 q- X# b8 f0 ^0 F
  76. char *dmabufdest2 = NULL;( J6 z5 |) M! W& C: E2 S# ?
  77. ! _% u' ~% C; h1 ~5 A2 G
  78. static int acnt = 512;
    3 }# f( n  J: K* [
  79. static int bcnt = 8;, g0 S6 W) H4 B
  80. static int ccnt = 8;
    9 |( O5 M, a7 g0 d6 b0 W( f* [

  81. 3 o) _- L; A' Y  Q# C- i" i, r! r
  82. module_param(acnt, int, S_IRUGO);' I: U! b1 Z# y, P+ \$ m
  83. module_param(bcnt, int, S_IRUGO);
    * w0 j$ c5 d, f; z6 f3 K
  84. module_param(ccnt, int, S_IRUGO);
复制代码

1 n, o$ S  }- k. T* T; u) A! l1 L8 P+ T  w
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用) l$ t* U. J; q$ D( k, d* m
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。, O# u- W$ E6 F" m
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。  B8 j2 G( H% G8 R1 }, L, j7 W4 x

5 s+ \  `/ q/ r: T( D2 p
5 x/ b, r* i) z% U: q! y) e7 \
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-3-14 02:54 , Processed in 0.053849 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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