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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 : t6 e! k: G% m* `6 ]
  1. [code]EDMA sample test application
    2 [) G7 J& Y; f# V( h
  2. /*
    5 Y7 z! [" }; Z5 _$ T  b( ^' \+ Y
  3. * edma_test.c
    ! ^; Y. u8 M/ b. d  Q! l
  4. *
    4 q2 ?( y# N9 t% C9 q2 Y+ v
  5. * brief  EDMA3 Test Application1 }1 r5 L5 v3 R) v( ~8 M# S
  6. *. i0 I. E  ?( K) n3 p9 z+ O6 C
  7. *   This file contains EDMA3 Test code." v4 X" ^5 y, T9 L" a
  8. *
    4 R( S2 ^0 {$ Y
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE3 o4 [2 ?7 c3 R; e' O8 |9 Z" V
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    * C0 g' U0 M! z( ]  W
  11. *         TO CHANGE.8 J; U* X( c# |
  12. *: [# P: l9 k$ K4 ~; e6 Y& H
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/! P, K# J+ m; c* K' n
  14. *
    ! z6 e. B/ P+ L* |0 L) L9 g5 p" p
  15. * This program is free software; you can redistribute it and/or
    5 O" K+ U0 V; k# i- Z
  16. * modify it under the terms of the GNU General Public License as
    9 I0 b0 w. t! W& s
  17. * published by the Free Software Foundation version 2.* j6 z* m+ r; D1 D! m+ |
  18. *
    $ _9 K# a. ]3 M, K: o/ p" i  z
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any* W- D* J, X+ p2 {' |. ]: Q  L
  20. * kind, whether express or implied; without even the implied warranty( V1 o8 a8 W  B: e
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the* {1 T4 l0 h) `2 y+ i
  22. * GNU General Public License for more details.
      C5 t# Q) E0 K; x& y" k3 ~: v0 M
  23. */
    4 v- ^* ?5 p6 N) s/ x+ _
  24. 8 u( e2 e# i  \6 ?6 g3 z
  25. #include <linux/module.h>8 ]3 z: E2 I, S# [" V* p
  26. #include <linux/init.h>
    % I& R6 {9 f! H$ Z% n
  27. #include <linux/errno.h>% ~3 O5 {1 w: S  S: |0 V/ v4 j
  28. #include <linux/types.h>. H/ Q9 S3 z; l, p1 l. L
  29. #include <linux/interrupt.h>
    2 i4 U2 ^2 f( k) [' K1 D* g
  30. #include <asm/io.h>
    4 }5 C2 i6 l- x7 K4 c
  31. #include <linux/moduleparam.h>
    # I, O! j6 W9 w9 c6 Z, i7 R7 U
  32. #include <linux/sysctl.h>
    9 G0 M% k* k$ g9 L
  33. #include <linux/mm.h>% `7 n: f7 M2 T5 B$ l+ w
  34. #include <linux/dma-mapping.h>
    & Z1 d8 E% A/ ~6 t  _5 p

  35. 5 i% I/ L( {' @4 R7 K3 o
  36. #include <mach/memory.h>
    3 p- }* x( B4 m8 S) \* A
  37. #include <mach/hardware.h>3 [! E# a. P% X, H+ f
  38. #include <mach/irqs.h>1 Z& n# C4 P" m
  39. #include <asm/hardware/edma.h>* }6 M/ P: h) T) {3 M7 [/ a0 d; p& j
  40. 8 ^% K4 Y& R! T3 R; z/ G* n
  41. #undef EDMA3_DEBUG
    6 b! Q" @+ Z% b' b; E8 [
  42. /*#define EDMA3_DEBUG*/
    # X( Z6 \8 v1 b, N" w4 }5 ?4 j' ~
  43.   k  Y1 [+ j9 B# g& _
  44. #ifdef EDMA3_DEBUG
    4 B+ x. ?7 E" r% M* W" i
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)- [: m# V) h9 \6 v3 Z
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    : g! @2 z/ @% ~$ |
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    1 A$ i& x* b1 ^/ G1 A- W6 w
  48. #else9 ^; ^1 ^! p/ ], R
  49. #define DMA_PRINTK( x... )3 A/ l5 k% l* M/ ^. K
  50. #define DMA_FN_IN
    4 ~9 L. s  w; ?1 F: t5 s
  51. #define DMA_FN_OUT  f6 L9 S7 `" R% C: J  g
  52. #endif
    % N; C5 {2 r; i2 L

  53. - }  ]9 e( B; g& ]0 X4 f. p- ^
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)- I$ G0 T% z  [4 c1 u
  55. #define STATIC_SHIFT                3
    ! x' r& X/ [& U6 J, j2 H
  56. #define TCINTEN_SHIFT               20* f1 I" S, o+ C$ f
  57. #define ITCINTEN_SHIFT              21
    ) E8 f4 E4 L" h* r6 v
  58. #define TCCHEN_SHIFT                22# [$ N$ d) K' K1 U! @$ p& e) D, [- c
  59. #define ITCCHEN_SHIFT               232 U- P+ m" e, R5 o, V0 l2 M
  60. ( u6 C+ a7 p" h. b5 k) g- D' E
  61. static volatile int irqraised1 = 0;
    4 z" q/ B9 B; n+ J
  62. static volatile int irqraised2 = 0;
    - x7 M# F" Y" E" l7 x8 w- w

  63. - \! h* ^9 b+ H  V! c+ e
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);- F+ S: p) h  T' e
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);, n; J) C1 O4 K- v0 j$ T' |
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
      y4 v4 @& G& Y, {6 o8 F( @1 P/ ]4 \6 u

  67. 5 F- _7 f7 t1 Q; R6 j3 Z
  68. dma_addr_t dmaphyssrc1 = 0;/ [" c$ y. S+ Z7 w* {
  69. dma_addr_t dmaphyssrc2 = 0;8 ?2 K4 l4 ?# L! ^; [) T) F( O! w
  70. dma_addr_t dmaphysdest1 = 0;- H2 q+ q' e4 M5 D. S8 B6 @$ L
  71. dma_addr_t dmaphysdest2 = 0;% f6 y. `* l* J  B9 L! i

  72. 4 z' H6 O. l7 [+ {
  73. char *dmabufsrc1 = NULL;
    9 Q, I9 r: ]+ T" Q9 v) B6 u
  74. char *dmabufsrc2 = NULL;
    & Q4 i7 u! N; y9 t+ ?
  75. char *dmabufdest1 = NULL;
    & N; H" e) l7 {0 s0 z& d* Z
  76. char *dmabufdest2 = NULL;
    ; P1 x! p% I9 _- N# p$ ?: P
  77. % m& H7 _- O6 @1 K
  78. static int acnt = 512;
    # `: ~! D9 ~5 e$ g
  79. static int bcnt = 8;4 t6 e# @. \  f
  80. static int ccnt = 8;
    * t2 [" e# W/ _: ?: I
  81.   e: n* p1 Y  T& d
  82. module_param(acnt, int, S_IRUGO);* S' x+ X# Y, {
  83. module_param(bcnt, int, S_IRUGO);' W: U4 C4 `- i0 ?
  84. module_param(ccnt, int, S_IRUGO);
复制代码

) B; S6 m5 m, R7 F& U
( ^9 p$ |' k+ c: q% L8 f      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用7 u9 e* x1 f1 f* g! o9 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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
+ e. B% ^$ }" A) ?     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
& i) x+ X8 f- C/ F. N0 @' K! z9 c
0 @3 N& _5 G% @3 `3 r
% O& X3 c6 w+ C5 F: }. g
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-2-18 08:36 , Processed in 0.040510 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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