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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
4 h$ K% f; [: E5 N
  1. [code]EDMA sample test application& j( z/ L3 E6 ~% ?5 i8 M0 f
  2. /*
    $ t1 M) f2 D6 A4 B3 p4 D0 u; ?
  3. * edma_test.c
    9 C) S; s; i! w' G. [
  4. *" e* I1 g2 M3 c7 q1 X2 }7 f
  5. * brief  EDMA3 Test Application7 Q  _3 M0 f9 d7 U5 s
  6. ** ?* G8 z3 V: w: J/ g$ e
  7. *   This file contains EDMA3 Test code.
    7 f1 @" r2 ~+ u9 N, E5 b  p
  8. *
    4 S, j/ [8 P, |) q7 I
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE8 M2 T/ F# _* o& y
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT* Y( T0 X0 d3 z
  11. *         TO CHANGE.9 s: s7 P) ~" ^' @( _9 |  y8 K, ^$ k
  12. *6 z/ d6 {; e- k  M2 U
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/6 A; `2 ?' }9 y6 b" y7 T" x. |: s3 B
  14. *8 {) M: `! w: C; a
  15. * This program is free software; you can redistribute it and/or1 {  \! ~8 D' k' q
  16. * modify it under the terms of the GNU General Public License as
    7 f5 y8 W  e% k& i: [
  17. * published by the Free Software Foundation version 2.
    ; I$ F4 Y; ^1 m
  18. *, _7 k8 r  R% g. ~
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any, J. V3 }3 y/ G
  20. * kind, whether express or implied; without even the implied warranty3 w7 j* L& @" `
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    / ^( m& K4 o) H7 V2 e& J- ]4 k* j
  22. * GNU General Public License for more details.% i' K' D0 K( e# \) V/ a6 v+ t8 a
  23. */. |9 r0 D% S% H: |* i+ \* I' n
  24. & j. R4 Z4 E3 H) Y4 n9 D
  25. #include <linux/module.h>
    $ b# a$ l+ a3 n5 J# Y
  26. #include <linux/init.h>0 t; t" a) |8 t3 t7 k
  27. #include <linux/errno.h>: u% \3 q+ j' `
  28. #include <linux/types.h>
    + \" {! G" K( \6 `
  29. #include <linux/interrupt.h>
    - \( I1 e' _4 z6 I4 J4 @* d
  30. #include <asm/io.h>( X$ W8 ?! z" l% v4 r
  31. #include <linux/moduleparam.h>5 U" S1 @; q  b
  32. #include <linux/sysctl.h>( C' R" V1 [# q' A7 m5 Q
  33. #include <linux/mm.h>
    5 m7 y  Z# h1 ^: U
  34. #include <linux/dma-mapping.h>
    0 p$ f* e* J2 P- @
  35. & h) c. q8 ^# }% {! t
  36. #include <mach/memory.h>5 x5 D. ]  ?! n2 a* T
  37. #include <mach/hardware.h>
    % G8 h3 X7 u9 n' E4 s
  38. #include <mach/irqs.h>% Q$ d# }! `' |) d" l3 {7 f& }
  39. #include <asm/hardware/edma.h>" h3 s3 y# G% x" j/ r2 {1 ?
  40. , t8 O, Z- z6 H, z  ]! i" y
  41. #undef EDMA3_DEBUG
    8 u) ]# `) w' b1 ?/ F- H
  42. /*#define EDMA3_DEBUG*/& b/ G) l3 f2 t

  43. 0 |3 |, x6 N5 |4 `' c9 C- Z8 T
  44. #ifdef EDMA3_DEBUG
    # ]1 n: U4 X2 M1 x/ X
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)# M( H, f: O1 o
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)+ c3 M0 ~5 v4 D
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    ( q, q. n% {$ o: Y% w4 m
  48. #else
    " l9 U' F7 F8 i6 ?; p7 H* _3 }$ ~9 `
  49. #define DMA_PRINTK( x... ): k3 ]# a; G+ r: A7 q* }
  50. #define DMA_FN_IN
    3 e/ ?2 v( Z7 X2 X/ t- W
  51. #define DMA_FN_OUT
    ) ~4 R; m+ P' l9 |/ R4 v
  52. #endif
    # C/ |/ j" f5 S( {- e- J
  53. 6 {) i6 v# H7 L5 q
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    # `; [6 @, h+ \% t4 T
  55. #define STATIC_SHIFT                3( H& {& P+ n- k$ m, D
  56. #define TCINTEN_SHIFT               209 q$ \( m% g; T, s
  57. #define ITCINTEN_SHIFT              21
    ) K, a; ?6 \7 `
  58. #define TCCHEN_SHIFT                22
    0 d& T& ?' h% x* a& W
  59. #define ITCCHEN_SHIFT               23
    / ^! [8 b" n2 t5 n8 O

  60. , i, [" K+ |0 ^: d
  61. static volatile int irqraised1 = 0;: k# K6 L! d6 e8 J$ D9 D% W
  62. static volatile int irqraised2 = 0;3 S4 g' m4 x+ h/ \1 B( y& ~& D8 d
  63. 5 F' w" I' n" F. s4 e! C
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    + L3 p% P, I# Y& s7 O) b4 h: X  f
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);& I* Z) z5 _: |0 e
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);. a9 c. Y/ ^9 m( v
  67. - w3 j2 i" k4 u3 j! P  N: N3 k2 h
  68. dma_addr_t dmaphyssrc1 = 0;# l4 K5 p1 @1 N1 J
  69. dma_addr_t dmaphyssrc2 = 0;' E2 E  `( L* M" S5 n! R! F: d+ o& e
  70. dma_addr_t dmaphysdest1 = 0;3 r8 T7 c3 k; B- _! J4 b6 P
  71. dma_addr_t dmaphysdest2 = 0;+ V( x  S: p0 Z
  72. 3 {# W, ]4 t. r2 W( C* Q
  73. char *dmabufsrc1 = NULL;. x3 y& n# L! @2 b" d5 ^" S2 r
  74. char *dmabufsrc2 = NULL;5 a$ s) O% L9 b% W- ~  R3 C( e
  75. char *dmabufdest1 = NULL;
    0 Z# @& x. C' m% x
  76. char *dmabufdest2 = NULL;* n0 {* Y' ^- ~( w0 K; e6 b

  77. . p& @" m8 _1 F
  78. static int acnt = 512;
    , f: O$ K/ n; X
  79. static int bcnt = 8;
    ! Z! @7 p, p( \- W- F% j$ Q
  80. static int ccnt = 8;" ]; P  o! r4 W) @8 B

  81. ; u" h& `0 ]5 M+ V; F* [# H$ e6 N6 H
  82. module_param(acnt, int, S_IRUGO);
    ( M/ s1 ]7 k4 I. M
  83. module_param(bcnt, int, S_IRUGO);
    ; j7 k0 l1 ^" w0 U( I6 v
  84. module_param(ccnt, int, S_IRUGO);
复制代码

4 N1 ^) ]; y; Y6 o4 J+ J- v1 |# ^% n
5 R4 O/ o+ e( F/ l( r1 I3 a. [      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用7 m0 @, C5 m" w  g2 \! 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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。: v; }+ E, D4 b8 F! j+ H* W, N( k: e
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
. q9 n! G- E. Q+ G+ W8 A: e: _
3 k/ P+ n5 y, h
& F$ s& Q) `; T2 E! z- n- h2 R
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-1-26 03:44 , Processed in 0.038898 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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