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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
  U" x  E# g2 i
  1. [code]EDMA sample test application
    6 X" T8 g( s$ j* x) r! f1 P1 o$ \
  2. /*
    * O4 R* p. P; L' z9 h' v% ^
  3. * edma_test.c4 F$ Z' e. b, _* K, d$ T. r) \
  4. *  v) t2 z* w: I8 p* q# q
  5. * brief  EDMA3 Test Application
    / J+ k& ]0 D6 X9 c
  6. *+ A; D2 S; ?- o2 U9 Z. E  V2 e
  7. *   This file contains EDMA3 Test code.
    4 s# m+ Q$ L5 _) h2 Q+ }+ M2 O
  8. *
    - }/ R+ m6 u0 L
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE+ h( I3 r. ~1 r& Q8 s) k
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT, r2 X; v/ X6 v6 h% w7 U; y
  11. *         TO CHANGE.3 X9 w% l  c4 Q$ D& d
  12. *
    ! x8 E7 I% q+ X* P% t3 t/ m/ O
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    / W/ C8 R2 G1 P, l' D
  14. *! [2 h# j' Y. l4 [
  15. * This program is free software; you can redistribute it and/or: c* S/ x( q! h
  16. * modify it under the terms of the GNU General Public License as
    + p5 j; _" T, B6 \
  17. * published by the Free Software Foundation version 2.
    - Z- u, @8 m5 |: q8 C+ s7 Z
  18. *8 \4 H- s# _* e; A4 D
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any7 w" G6 h* _2 w7 D% M
  20. * kind, whether express or implied; without even the implied warranty7 t) P$ Z$ ?/ v
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the; w. Z4 E. Z% N6 E/ Q) z. X; c
  22. * GNU General Public License for more details.
    & N& \( h& f3 R& ~$ C9 ]. F# C) ]
  23. */
    7 d3 T: `+ D: E9 t2 `" {3 s% G

  24. + K: x% K! \: V9 A5 f# c
  25. #include <linux/module.h>0 D' |& h8 e* `* i& ^+ M: ^" o  W
  26. #include <linux/init.h>
    6 b4 Z# o: Q4 S  S
  27. #include <linux/errno.h>
    5 m) S2 c, d6 ?; p8 P
  28. #include <linux/types.h>6 l- A7 C! n& _( ]; }
  29. #include <linux/interrupt.h>! m7 d+ R6 K& j# _
  30. #include <asm/io.h>+ J: T; i7 o  ~: B2 J; z5 A
  31. #include <linux/moduleparam.h>
    2 D& o" P* S4 g9 ~; F6 c
  32. #include <linux/sysctl.h>, a& r' J8 B7 L' F
  33. #include <linux/mm.h>2 ~( y0 c' i. L8 H# P8 A5 ~3 E' t
  34. #include <linux/dma-mapping.h>8 Z  R0 [" d) H- E9 c- _
  35. 1 [) I4 g. t  Q9 v1 f7 i; U
  36. #include <mach/memory.h>! L% n: C2 z. P4 Y& {5 S
  37. #include <mach/hardware.h>
    ) C/ U' ^4 S$ u( @& c6 F1 |  M
  38. #include <mach/irqs.h>
    5 g$ b, x* x& I
  39. #include <asm/hardware/edma.h># s' U0 t0 r! D) B( R0 d7 {& m
  40. 1 t% h* b' G( B( i
  41. #undef EDMA3_DEBUG& {5 e, u9 ~- _9 r" n0 c$ [
  42. /*#define EDMA3_DEBUG*/* A3 L* V" N! m1 |- c- u: M+ X( u
  43. . c  U8 u- W) S- c
  44. #ifdef EDMA3_DEBUG
    ! X; ~) r4 \! S
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    & |! p) b& E4 Z& @2 r0 m' ^/ Q
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)* \' h! R. L: u. M' S# N: r
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)# t0 \# G  {3 Y7 o
  48. #else: U) ]! ]8 [. r6 O$ b5 w
  49. #define DMA_PRINTK( x... )* N/ W5 r! `- a$ P# m/ @0 k
  50. #define DMA_FN_IN$ ?1 l5 B6 ~( q3 _6 E& j. K
  51. #define DMA_FN_OUT
    3 ]1 s9 O) J9 d2 w  ^3 ~
  52. #endif
    " x7 S% k0 C4 I$ y- O2 ]4 o
  53. 9 |6 T8 \% w3 \
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    ) F9 L9 F  w2 J  i* f* F
  55. #define STATIC_SHIFT                3
    4 w" Y. J9 O. s( t
  56. #define TCINTEN_SHIFT               20* }& q0 T7 `" F' Q. f4 e- R* r
  57. #define ITCINTEN_SHIFT              21+ |$ R8 j* \4 |1 B
  58. #define TCCHEN_SHIFT                228 O0 c: {/ B+ }9 `- d
  59. #define ITCCHEN_SHIFT               23/ W" ]3 ^% K6 J# m
  60. - w* w2 t& B+ s4 o; o' K$ a5 Q0 p, o
  61. static volatile int irqraised1 = 0;
    & `% ~: A6 e7 ?$ d- k5 x
  62. static volatile int irqraised2 = 0;
    5 p4 f5 `, R2 e
  63. 7 o; N; u1 ^$ Y- _  R
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);) z6 f  O9 O+ {3 p
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);  Z0 s: \5 \2 B8 }1 a4 @
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    1 Y  m- ?2 Q; p  [- F: U1 N& c
  67. , o9 X& q1 x- X2 e$ U# t
  68. dma_addr_t dmaphyssrc1 = 0;
    0 d* q7 H8 O: `/ q) P: l+ j
  69. dma_addr_t dmaphyssrc2 = 0;' q3 t5 X& C( f' o; u
  70. dma_addr_t dmaphysdest1 = 0;3 P. w# h' m$ q: Q* J
  71. dma_addr_t dmaphysdest2 = 0;4 W1 s  I+ }  y9 s; m

  72. ' U% A) ~2 g. F% C. g3 L* q* N( |
  73. char *dmabufsrc1 = NULL;
    ; j0 c9 |1 g9 h  }
  74. char *dmabufsrc2 = NULL;
    0 f, @; [# y! ]; q
  75. char *dmabufdest1 = NULL;  Q: P) n* v+ q- _0 e5 R( e7 [
  76. char *dmabufdest2 = NULL;* l1 N! E. H9 z8 N' O' I

  77. & ?0 I6 E' V, P4 i7 U6 E
  78. static int acnt = 512;
    # I8 D& V9 A: ?% O  O$ F' ~3 d
  79. static int bcnt = 8;
    . Z3 M3 ~; u- O+ Z+ n
  80. static int ccnt = 8;- v) y/ X! i/ _; c  O  {3 B! o

  81. 3 b3 T3 _' \6 d2 r9 ^( h% ~, D  D
  82. module_param(acnt, int, S_IRUGO);
    " Y3 |$ k1 P# b$ m
  83. module_param(bcnt, int, S_IRUGO);
    8 S/ u9 {" u( o6 U
  84. module_param(ccnt, int, S_IRUGO);
复制代码

" P" b9 ~, Z  I& c  |3 Z7 L! K2 L* J/ _0 e5 n7 d; G( X
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
; i% R& [5 ^8 Garm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
# [+ |% u3 A; h# d+ _" o* ^     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
; I! f" Q) g" V; k8 c; E1 V" l
* ^* f8 E4 R% J3 O1 C6 i$ R" x6 a4 d* A5 q$ l; K0 X5 ~) d
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-12-27 04:17 , Processed in 0.037182 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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