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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑   P  ~  `4 f, H1 }
  1. [code]EDMA sample test application
    ; \0 b0 j6 u! z
  2. /*$ ^& |* I0 u* C0 S" B
  3. * edma_test.c& q. x. [" |) o+ |% o
  4. *% _2 {8 K+ Y" L" x. V& j5 V8 B% Q3 M
  5. * brief  EDMA3 Test Application
    5 V: j$ |: R) P7 F' Q  l
  6. *
    % D4 r7 X7 n- W2 ~
  7. *   This file contains EDMA3 Test code.
    ; f; j  O8 w  \$ E1 \) p, G4 L% @  d
  8. *
    4 p, c: d+ I  x% z6 d9 u
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    4 T' V3 B  I$ L: [4 D3 C& B
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    - t/ V0 Q& r6 M$ p- h  @/ z
  11. *         TO CHANGE.8 O* W5 M! \0 i' t7 V$ P/ X6 @: F
  12. *
    : x! j# L$ o. V
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    $ T0 L' a2 f8 Y0 F2 N7 R
  14. *2 j8 S* Y, G0 W# K. o: I3 I% I
  15. * This program is free software; you can redistribute it and/or/ g$ v; i* L: X0 z. j
  16. * modify it under the terms of the GNU General Public License as
    % C' C$ `1 [* H1 M- t: I
  17. * published by the Free Software Foundation version 2.
    ) [2 j, G( u5 s
  18. *
    0 n7 G9 i3 a" O- l
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any7 I8 X5 M6 w$ x1 h& r% u2 W5 E
  20. * kind, whether express or implied; without even the implied warranty( H' A# ^, l' r2 W
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    . w, d8 c! @6 \; [% V; S8 l: r
  22. * GNU General Public License for more details.3 [9 ^0 D7 K8 Q5 m0 w
  23. */
    ) u! {% {5 [! G; I9 @- L" T

  24. 7 u/ _$ Q( Q3 f8 w% P7 {
  25. #include <linux/module.h>8 g$ V& w! e1 j& X6 e$ i
  26. #include <linux/init.h>
    3 Y! e$ z/ V, F+ w1 o
  27. #include <linux/errno.h>, H. K) o+ W4 G" {+ ~
  28. #include <linux/types.h>
    " X+ j: U! B' w# x# _: \! \
  29. #include <linux/interrupt.h>
    $ N& O% {/ H* d. K' Y+ K/ b3 a
  30. #include <asm/io.h># S+ O+ V. ^6 O+ U% Q; g5 U3 v
  31. #include <linux/moduleparam.h>: ]' u: s7 G' F5 ~) W
  32. #include <linux/sysctl.h>- L, R( C# r2 T6 Y6 h
  33. #include <linux/mm.h>
      c9 q8 w; c. T  T
  34. #include <linux/dma-mapping.h>8 ~2 b# L; @& p* P! D) H# t0 i

  35. ; a! f0 N7 F! D
  36. #include <mach/memory.h>4 g# b1 v4 k* w$ B
  37. #include <mach/hardware.h>
    / t/ {' f8 z% Y/ Q
  38. #include <mach/irqs.h>4 E, K1 t5 s. {8 J, }
  39. #include <asm/hardware/edma.h>
    0 M- B6 t3 p5 q  n# g. m4 g

  40. " G) q# E) n0 x! w
  41. #undef EDMA3_DEBUG* }3 G% b& W2 E0 h' q& U& ]
  42. /*#define EDMA3_DEBUG*/
    & N8 {8 X& l; ^# b/ `! ~' H/ x7 |
  43. : ]/ L5 P8 _- ~' ]! _* \/ [3 b
  44. #ifdef EDMA3_DEBUG
    ; @1 A8 b3 T: l) a3 Z$ {& o3 N
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)* k% |+ i3 g1 w7 J( s3 k
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__). B+ a6 Z! p9 g* U5 k: f
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)! N1 Z# o# B: b$ s9 A
  48. #else0 C. k5 D8 Z- {. p6 Y1 B
  49. #define DMA_PRINTK( x... )
    ! W- [8 W) y- y# Z& \7 |2 X
  50. #define DMA_FN_IN1 p6 s/ I. `# N. h
  51. #define DMA_FN_OUT
    7 o% {. d5 I  E
  52. #endif
    6 S" S' G+ D* _6 j
  53. ! j" R" z0 M* t9 @
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)& E4 w; O0 S1 G
  55. #define STATIC_SHIFT                3) M6 A: F  K: f+ Q
  56. #define TCINTEN_SHIFT               20
    " F& ]: p! V; T# ]
  57. #define ITCINTEN_SHIFT              211 u8 i) O* M5 q+ M4 H1 {( e) F
  58. #define TCCHEN_SHIFT                22
    : s. t+ |% o- K" E0 s2 W0 e
  59. #define ITCCHEN_SHIFT               23
    * {' a; Q! d" }0 ~/ I1 W. Y1 Y# n

  60. + i5 }& F2 _8 ~0 z
  61. static volatile int irqraised1 = 0;
    ( c, W6 j, A, ?/ r3 X& b% [1 }
  62. static volatile int irqraised2 = 0;; d( M, }8 ?. f9 r
  63. 2 |4 ^# N1 ?, f# M. W
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    4 K' t" c6 n" v$ t3 e( a( M
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);: H4 w; B, f0 D  B
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    3 _- p: J9 I: E" a
  67. , ~/ k7 s! p- Y; f5 q
  68. dma_addr_t dmaphyssrc1 = 0;. Z4 N6 R/ I$ g& Z
  69. dma_addr_t dmaphyssrc2 = 0;3 o7 V0 C5 T: W
  70. dma_addr_t dmaphysdest1 = 0;
    : n7 j* [. `& O8 B  J- ?# r1 Z/ X
  71. dma_addr_t dmaphysdest2 = 0;8 Y" Z( H* i# Y: k
  72. 5 }- g0 ~. z+ [# J9 Q" r" b' L. @
  73. char *dmabufsrc1 = NULL;
    " o& O1 D' E3 P3 s6 G
  74. char *dmabufsrc2 = NULL;. w4 h$ R1 V3 i* [5 T
  75. char *dmabufdest1 = NULL;
    & {- ?) y1 d! ~3 A8 y2 L" U
  76. char *dmabufdest2 = NULL;9 _: q! w8 a  t. `- a( n& a" S

  77. 5 u4 b$ o  B  K1 E8 [" ~
  78. static int acnt = 512;
    6 c* U6 G- Z4 b8 x0 W* U: `  N
  79. static int bcnt = 8;9 m& k5 P, u- i& |% M
  80. static int ccnt = 8;
    ! c! \9 b+ ?! t7 @# m: X

  81. 3 U  l5 R* S& u
  82. module_param(acnt, int, S_IRUGO);
    8 X/ ^- |- ^- i
  83. module_param(bcnt, int, S_IRUGO);5 O4 O3 X% j" i
  84. module_param(ccnt, int, S_IRUGO);
复制代码

) n9 c+ J1 N7 J
% U# U9 j: Z# n2 w% c6 V$ \      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
4 k1 B7 L/ p1 q  b5 Xarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。! N7 p9 k" S! c. R) K$ e" }3 L
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。5 `4 Q7 }% v5 n" H$ a
9 D# p$ l6 b1 j

  i& C0 x% `% l1 z$ t5 |
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-1-24 09:30 , Processed in 0.039951 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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