OMAPL138如何在Linux下使用EDMA3驱动 - OMAP-L138 - 嵌入式开发者社区 - 51ele.net
设为首页收藏本站

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 / `9 r3 ?; Q! t' S" ?9 |
  1. [code]EDMA sample test application- h! W: |& Q2 h# G7 p& c( O  d
  2. /*
    ) L5 l1 ^% ]; z8 {! i9 G( Q, l
  3. * edma_test.c
    # p( g( h) Z2 m4 F& m/ R) ~
  4. *
    # f( T1 r" \" ^' e" g
  5. * brief  EDMA3 Test Application
    ! ^0 `6 ?0 }1 o  D* O& _6 L
  6. *; |' w5 P7 ^* C; M
  7. *   This file contains EDMA3 Test code.
    4 b  g0 @1 r3 j# |! w
  8. *
    $ M+ y4 y' f! j" `/ M* _) `
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE' b9 }: N) c2 E4 m0 [( f
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT9 \; P# p1 n/ `3 i, ]% H
  11. *         TO CHANGE.
    " \, v% K' D/ J7 ~/ k; D$ i* f( a
  12. *. E7 M* f  v- D7 i5 O$ p
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
      K) e; D8 t2 e: S# c5 u0 d9 K
  14. *) Z, i) a3 R. _2 h" P3 p
  15. * This program is free software; you can redistribute it and/or
      @2 i; E% f: `+ k! a/ M
  16. * modify it under the terms of the GNU General Public License as
    : D' w% S% J! }0 O
  17. * published by the Free Software Foundation version 2.0 O% K9 |( p( m; r) a4 L
  18. *, t% U% b/ z8 s
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    ! y. @/ r! L- N) I* n* o
  20. * kind, whether express or implied; without even the implied warranty  g  V1 @" d$ N, ~9 i
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    7 M- _9 l$ O! l5 Q3 Q! ^5 I) w
  22. * GNU General Public License for more details.
    $ C+ X9 z6 F. y- a! s+ W# K
  23. */* Z! w0 G; T6 ~2 p6 l

  24. 9 l5 j! i! ]+ j9 |
  25. #include <linux/module.h>
    4 W$ R/ N  `: }( c
  26. #include <linux/init.h>
    / n1 R& q. Q( E( t5 T) I- b
  27. #include <linux/errno.h>' R9 \5 I! I3 F% Q
  28. #include <linux/types.h>; a. a' h5 k4 _1 ?4 q) I1 }
  29. #include <linux/interrupt.h>
      g# Z( _+ T- e8 i! w
  30. #include <asm/io.h>
    * ~. B  u1 Q0 @0 P# H" W
  31. #include <linux/moduleparam.h>4 \9 Y, {+ y/ i- G
  32. #include <linux/sysctl.h>
    4 s+ k/ S9 ?5 T% A8 h
  33. #include <linux/mm.h>
    6 L! F! w! \' I
  34. #include <linux/dma-mapping.h>$ i7 b. ~6 g- R$ l

  35. / x- ^9 h' ^7 S
  36. #include <mach/memory.h>& \( y' m' ^* Q
  37. #include <mach/hardware.h>
    4 }1 ]9 N* V$ [/ V8 p
  38. #include <mach/irqs.h>
    3 I! y# c# a; s! |* G
  39. #include <asm/hardware/edma.h>5 B- B3 q; m( J" l0 n5 y8 H# i' l1 Q

  40. " Y) g' O' a% d3 Y! |; y8 m' L6 y4 Z
  41. #undef EDMA3_DEBUG. _, q! X" F! P
  42. /*#define EDMA3_DEBUG*/$ f5 O/ t3 J" F/ C, e

  43. ; P  f; w7 J0 X" V' r3 S" c9 R  e, ~
  44. #ifdef EDMA3_DEBUG
    & s& g% ^' Y) _$ }: x6 m
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)- P# S) t. }: F/ c/ _. k
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)- k* D1 ~) O: H* v
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    / b, Y9 ?. z  r3 \
  48. #else
    2 y& A# T' i- \& [2 r+ M& V3 y3 M
  49. #define DMA_PRINTK( x... )5 H* Q0 y# c) ~( F3 [) O2 a+ U3 w' D
  50. #define DMA_FN_IN$ ~: h  d& q% G+ H
  51. #define DMA_FN_OUT
    , ~3 M- }7 T; N8 }$ R+ I5 i, e! o" j
  52. #endif- n/ `7 W6 d1 q" [' ^/ g
  53. & D1 M8 M8 Y0 M$ \+ f' l8 |
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)8 e6 a/ v. c1 M
  55. #define STATIC_SHIFT                3
      {/ v9 L" |0 H4 v$ Z" U
  56. #define TCINTEN_SHIFT               20
    6 ?2 d9 D& ]2 W/ t- W0 k
  57. #define ITCINTEN_SHIFT              21
    , ~& v0 ?. K3 G8 |, A
  58. #define TCCHEN_SHIFT                22  ^# i0 L+ M! z
  59. #define ITCCHEN_SHIFT               234 ]) L' R3 S4 Z1 s* b) w6 e
  60. # h9 n3 L2 a) i$ H% J0 \7 n
  61. static volatile int irqraised1 = 0;1 {5 V, I3 ]2 J% f7 V1 q
  62. static volatile int irqraised2 = 0;" H: T- N# H9 h8 k

  63. $ H; A5 s) f) i3 C: R6 Q0 ^2 u$ y
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    0 ?9 n$ c* r8 E/ k9 Q
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);2 a% F5 M8 x- ^0 J; K
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);: K! L) I; I: [- |2 F

  67. & {6 R7 d: v$ t" ]' n( z% W
  68. dma_addr_t dmaphyssrc1 = 0;6 ?' o/ y' D& V
  69. dma_addr_t dmaphyssrc2 = 0;
    3 }4 q8 v7 W) s5 h& m$ A
  70. dma_addr_t dmaphysdest1 = 0;
    6 O% Z; c9 [5 I# }; |6 \2 y1 y. J0 n
  71. dma_addr_t dmaphysdest2 = 0;
    % C8 M! i( j8 j* K4 Q
  72. # I; R! n& n: W5 S. M$ P' O
  73. char *dmabufsrc1 = NULL;
    6 r0 [+ U# p: S# @2 ~" j& z  s, \% L
  74. char *dmabufsrc2 = NULL;
    , U6 L! J* Q4 z" _
  75. char *dmabufdest1 = NULL;& m$ I/ i' i5 k
  76. char *dmabufdest2 = NULL;. k5 i" a) Y2 k; |1 Q" f/ U
  77. 9 D- w2 ?4 ?: @
  78. static int acnt = 512;
      B: x' B! f: o+ g) a
  79. static int bcnt = 8;# P" Q6 U; L+ N* P
  80. static int ccnt = 8;5 D6 {2 N6 a) Z$ o* X& t  W) B
  81. " S% M) |: j' G0 i6 b. U
  82. module_param(acnt, int, S_IRUGO);2 [# z% v+ N8 _8 G4 A: b
  83. module_param(bcnt, int, S_IRUGO);4 H6 b. G  x; r  q, Y9 X: `
  84. module_param(ccnt, int, S_IRUGO);
复制代码

( T8 Q1 `8 W1 u+ G" d* ]$ @% r4 Z0 y+ e* d+ F$ L7 S5 j& M- Z
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用: `- N% b% {3 g. i1 j+ s: z
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 f6 e+ G- ]) C) C# g* f1 `3 F     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
3 O; c4 }' e4 @& o* |  j
- N& Z6 _" n2 [4 s5 M9 a$ U5 c
9 L3 {8 d. D# h
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则


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

GMT+8, 2026-1-13 08:04 , Processed in 0.044796 second(s), 27 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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