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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 + ^( k0 ]7 _, [0 o6 f
  1. [code]EDMA sample test application
    ' P' }8 s) H/ @& N  ^
  2. /*
    5 `  F' R% y" U5 ]
  3. * edma_test.c
    9 `# a/ L4 d& M3 [
  4. *2 `7 X9 m& @6 n0 ^
  5. * brief  EDMA3 Test Application! ]8 t/ E3 S4 {* @: W/ s9 u, F* ?
  6. *
    + H3 e0 r3 o% N& D+ n. R/ f4 q
  7. *   This file contains EDMA3 Test code.0 v$ b$ x* H" q+ s9 }2 r
  8. *3 X; V6 l. E; q+ o" [5 u0 k7 o
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    9 \4 A8 v( J5 Z7 c
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT8 W+ M8 g5 C4 O
  11. *         TO CHANGE.
    & L& P' b. ^% B6 C9 N( {( Y
  12. *. o- c1 V  [, o
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    # N/ N/ V" O/ j  V5 W
  14. *
    8 q0 w: b! O) n- S+ w! y1 ^
  15. * This program is free software; you can redistribute it and/or" d' h. ]. n7 b" N
  16. * modify it under the terms of the GNU General Public License as: r7 d7 |' c+ S5 f* N- K% a
  17. * published by the Free Software Foundation version 2.& B$ S; u) ^7 r) N" S3 n2 m
  18. *
    ; `7 j& s( @9 ~# D
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    7 u  h2 a* d) R0 C
  20. * kind, whether express or implied; without even the implied warranty, u; T; Y! L" t- h
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the, ?2 C* M! C0 p! n* |, d; {  S7 R
  22. * GNU General Public License for more details.; Z' i' G$ ~% r8 l# y
  23. */
    ! v% A) a. j/ F
  24. / H+ F# ~; E. L. U3 \
  25. #include <linux/module.h>
    * i1 I. J: B! \% z7 _8 a8 N
  26. #include <linux/init.h>
    * T9 @3 ]0 i8 d4 b
  27. #include <linux/errno.h>% P9 z7 G* D3 J% o" e
  28. #include <linux/types.h>
    ( ]! u5 {) l: ^. x0 A- Q" B0 G" C
  29. #include <linux/interrupt.h>
    / W5 [1 y0 N$ f4 g
  30. #include <asm/io.h>
    ) m$ e8 m: a* }3 v
  31. #include <linux/moduleparam.h>
    0 ?% [* d: o/ Q% q6 }+ m( C, n
  32. #include <linux/sysctl.h>: Q! _$ B" s% _* r' E4 f; o- F
  33. #include <linux/mm.h>$ L" ?2 y# P: X* o
  34. #include <linux/dma-mapping.h>; z' u. ?# N0 M: @* O

  35. 3 M' u' z/ F  p6 ?9 h
  36. #include <mach/memory.h>
    * c" L9 v% i6 S. O
  37. #include <mach/hardware.h>
    " B0 G2 U, f" i
  38. #include <mach/irqs.h>$ C6 v  j* D# G2 T
  39. #include <asm/hardware/edma.h>% G  B" l. W. C1 |/ e' B( S
  40. 4 o6 d& `9 I3 h$ T: \$ m
  41. #undef EDMA3_DEBUG
    2 r# J+ e2 t; X
  42. /*#define EDMA3_DEBUG*/
    " }+ j9 z* {/ s  g

  43. 2 L1 n( _2 m6 @. n. o4 @1 H
  44. #ifdef EDMA3_DEBUG$ a' z, g# Z% h7 a
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)8 E! F$ Y1 l3 S7 U
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    5 P' K8 w9 v; F' S9 |( ]- o
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    6 ~& D8 z; d% |+ s9 A
  48. #else* j6 y( J; J# h
  49. #define DMA_PRINTK( x... )
    8 O( @8 \* u/ G1 g$ D
  50. #define DMA_FN_IN) c/ f* i+ c  B6 l( I0 ^2 _% J
  51. #define DMA_FN_OUT
    . [+ w1 U* r: d  s' y; w
  52. #endif
    % V2 D$ _: H3 t* L5 ]

  53. 6 T. L6 K2 `% K9 v
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)2 x( \5 A) u% u7 e' s  e1 v2 p' I% w7 \
  55. #define STATIC_SHIFT                3
    0 k0 }: ]2 o! E) V- |" _
  56. #define TCINTEN_SHIFT               20
    - k8 f  U. j2 O# q: `3 d
  57. #define ITCINTEN_SHIFT              21
    $ k  F3 F) ~  ~1 r% E- d9 i8 d
  58. #define TCCHEN_SHIFT                228 P) L, {3 l0 C* C  M& R* {
  59. #define ITCCHEN_SHIFT               23( I% s/ T2 f: m) P2 s

  60. 2 F* q1 S; Y, }
  61. static volatile int irqraised1 = 0;7 z) r. K0 C& y
  62. static volatile int irqraised2 = 0;
    $ k; |+ a4 m! O7 ^9 g

  63. % H# C# V+ |7 g
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    2 x1 ]: d. y; |
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    5 W* K, \7 R( K% i6 D
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    * t/ X: V& p  q5 K1 e

  67. ( X' c1 r2 C) h/ \7 b0 \
  68. dma_addr_t dmaphyssrc1 = 0;
    3 u! |, Z# n: U
  69. dma_addr_t dmaphyssrc2 = 0;
    3 M) X  z" j! z9 }) \' D
  70. dma_addr_t dmaphysdest1 = 0;: {: E4 R! ]) L0 Y! D
  71. dma_addr_t dmaphysdest2 = 0;
    , e1 t; W# S, N1 s) a/ }

  72. ; l7 M9 h9 X( H1 E2 ]! o4 ^
  73. char *dmabufsrc1 = NULL;
    ' f2 V3 j: D$ [4 z0 f8 L
  74. char *dmabufsrc2 = NULL;9 Y% }! a; j) K9 q. D$ @
  75. char *dmabufdest1 = NULL;
    0 R$ i% w- u  X2 ^; G! W
  76. char *dmabufdest2 = NULL;6 o" y; D4 p0 c  }5 c

  77. $ a$ X: |0 z# g. B6 m1 L/ {
  78. static int acnt = 512;
    % a+ S/ j8 D: ^
  79. static int bcnt = 8;
    % _! U) Y1 S6 V0 a3 {
  80. static int ccnt = 8;4 t4 J% ?" n; |0 f" b

  81. $ W$ x; g$ n/ Y" z! y7 w
  82. module_param(acnt, int, S_IRUGO);( Y# |. v! P3 q* c, {
  83. module_param(bcnt, int, S_IRUGO);% P9 ^3 y3 S7 }5 `5 b
  84. module_param(ccnt, int, S_IRUGO);
复制代码
& {  }7 B( D! B+ {8 \* j

, ?/ U0 u% B6 X      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
. `5 Q' |* R' l  X( J! B) {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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
3 U5 K7 f* `0 g& f     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
; \0 `! ]5 d2 ~6 U
  \, \, L. l) w3 F" \2 M
" v2 i6 O: {4 }8 y7 [/ a3 {/ g4 e
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-6-14 16:59 , Processed in 0.048806 second(s), 28 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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