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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 5 y5 H. c& Y  L- _/ W: k* o
  1. [code]EDMA sample test application$ O  K5 ^* S: c# l. x
  2. /*
    3 H9 `1 c3 f# ^& G
  3. * edma_test.c! V, z7 j2 H8 W& M
  4. *1 \' w; \4 G+ A& J0 A2 C/ H6 ^
  5. * brief  EDMA3 Test Application
    ! f* S8 |- P2 {* p& j
  6. *
    7 @7 U- n: n/ {
  7. *   This file contains EDMA3 Test code.6 ~3 J9 }6 V+ u1 G" X4 K2 K
  8. *# e- d. I) c/ T
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE' K) N, {4 g8 h( g) Y( `
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    , t3 E: d1 D6 ]# @' t
  11. *         TO CHANGE.0 D- @: H$ s) v2 D
  12. *
    4 B' d4 V" w4 N: I
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/1 F/ v) ^/ X( T2 z" y4 f" ?
  14. *. A0 u4 {3 c2 G: y4 `
  15. * This program is free software; you can redistribute it and/or& I3 u% A+ R3 F( X
  16. * modify it under the terms of the GNU General Public License as5 Y5 M: j* N: M) ?: V; L
  17. * published by the Free Software Foundation version 2.
      m! [, s( j' A' B0 o; d+ \
  18. *' S9 i/ P5 w/ G% ^
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    : U7 ~- e; y; H) f% \
  20. * kind, whether express or implied; without even the implied warranty* l6 L7 R( L: s% i( [7 l
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    " q. o  X& u) g5 H4 X$ t* d
  22. * GNU General Public License for more details.7 t7 A5 n# K( O% F
  23. */
    ( V3 x% z9 J. V6 \
  24. 8 S6 R! [* B% ~. ~  \" x5 h; q
  25. #include <linux/module.h>% B- g7 q: `0 h5 W
  26. #include <linux/init.h>
      `+ K  t2 H- j9 E3 e% H) \
  27. #include <linux/errno.h>
    " a  _1 J: K: L6 h% \
  28. #include <linux/types.h>
    ( t! G. [) G9 Y# U# W
  29. #include <linux/interrupt.h>3 b. A  U) S1 b2 j6 Z
  30. #include <asm/io.h>
    , N+ y9 p: s% K& h; w) {
  31. #include <linux/moduleparam.h>: ~9 J+ x! S. @1 \2 u+ l
  32. #include <linux/sysctl.h>4 p* w0 X% n0 _, z0 h/ `! t
  33. #include <linux/mm.h>
    $ ?8 E; e& [* a' K
  34. #include <linux/dma-mapping.h>8 \2 t. w3 |& }6 L

  35. - |( a9 c1 w2 T" H$ b; B" `
  36. #include <mach/memory.h>
    2 t% v/ w& N8 d
  37. #include <mach/hardware.h>: T! V9 Y0 W2 u0 X' U* U8 N
  38. #include <mach/irqs.h>* q" ^0 U7 [$ Q6 M  H+ n' ^
  39. #include <asm/hardware/edma.h>
    ) d* I8 M# v% O- B& y
  40. 9 V7 B3 z4 i+ @( K: R3 B6 z
  41. #undef EDMA3_DEBUG
    ! E# |: L/ A& Q( m
  42. /*#define EDMA3_DEBUG*/
    0 ]* M1 `0 |+ D3 M' B$ o2 P4 |
  43. ! F/ b. R6 s. F* y
  44. #ifdef EDMA3_DEBUG
    2 U2 y8 x# d$ E6 z( j
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)! b9 N# C8 t! r5 U  z: }
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    , }1 e7 B' p( ^8 j& ^
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)- u. o4 X* M% Z
  48. #else
    : m; W4 ^$ s! X9 D3 V4 v
  49. #define DMA_PRINTK( x... )0 O) Q5 I/ B9 J2 i0 ?1 O; S
  50. #define DMA_FN_IN
    ( P9 _% S& l/ b3 D9 p
  51. #define DMA_FN_OUT* D. m, \& W  I  i" p6 f% i" k
  52. #endif; w& J% n7 J  o# J, q3 ~

  53. ' C) M  s% E. i, ]8 J( z2 A0 }" V0 c
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)7 Q# ?$ @/ S  Z( o5 O) j
  55. #define STATIC_SHIFT                3. N7 B1 y+ T; V) p' D/ J' W+ R
  56. #define TCINTEN_SHIFT               205 w, M( K: S# G/ L! Q5 l
  57. #define ITCINTEN_SHIFT              21
    ' D- |  ?- G! O4 W; O
  58. #define TCCHEN_SHIFT                224 n4 k4 Z2 z3 ]  N  i* e
  59. #define ITCCHEN_SHIFT               23
    " [" m' [% k9 W) q9 c" H6 X8 B/ r

  60. 3 O; r' c6 t0 \
  61. static volatile int irqraised1 = 0;
    * K0 V& |. P( ~% V# p5 S# z
  62. static volatile int irqraised2 = 0;- O) J0 D, D1 K: }
  63. + h  O1 C/ x4 C& M& [; q
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);5 e* T+ C8 e! j4 p
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    % f' V( k9 r) m! T
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);  K  G4 X( q) o! T

  67. & c: C& L# {/ v+ p: D  ?. V/ p
  68. dma_addr_t dmaphyssrc1 = 0;- v. o9 h2 }% N& y( m# ]* d
  69. dma_addr_t dmaphyssrc2 = 0;
    7 E" }4 o7 Q2 D& L
  70. dma_addr_t dmaphysdest1 = 0;1 O4 q( j2 J4 }1 R' b4 s  W
  71. dma_addr_t dmaphysdest2 = 0;  r' L/ K* ]' n5 r
  72. 5 K- e0 n+ H7 s
  73. char *dmabufsrc1 = NULL;
    " h) T7 ]/ Z$ o+ s7 A0 d
  74. char *dmabufsrc2 = NULL;
    + Y. a1 Q( |- g3 [  k
  75. char *dmabufdest1 = NULL;
    + ?7 ^" X" V# h. x9 j6 b3 s
  76. char *dmabufdest2 = NULL;# ^: J3 r7 ^' C; m

  77. : Z. ^* o4 I2 I+ N4 }
  78. static int acnt = 512;
      n2 L. h: d3 _8 y3 t* r) M$ S
  79. static int bcnt = 8;  ~; d6 q" }- C* E. O
  80. static int ccnt = 8;
    * k! c7 C% }% {& F+ H& I0 c

  81. + J4 v4 {- h5 ?/ Z; \  k
  82. module_param(acnt, int, S_IRUGO);
    ; A  I7 K, l( Z/ f
  83. module_param(bcnt, int, S_IRUGO);
    6 _! ~  x) u7 s& ~9 E3 f
  84. module_param(ccnt, int, S_IRUGO);
复制代码
7 I# r9 b" a3 U  U5 C! Y' Q

+ k& f" D0 |1 V. }" i; _! T9 G" p      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用5 w, B9 ^: M, D4 I) Y
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 `1 H$ D$ e$ c5 S; C6 U' I0 ~" J
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
9 c2 v) J4 }; c( G, a) e% ^2 A1 J, O8 s3 G/ p
9 f3 p! L: |: G% C) \8 z
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-2-11 13:05 , Processed in 0.039624 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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