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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |正序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
  x) D  a/ }6 P5 t+ y3 z+ r
  1. [code]EDMA sample test application
    2 {- [) `' q; e7 l
  2. /*
    6 J( C7 a) M2 X' G. y: }5 E
  3. * edma_test.c
    % l0 c. }4 z  H/ k: h
  4. *
    ; C* F7 M' y0 {; t
  5. * brief  EDMA3 Test Application
    . K3 x  q" ~& @9 ?% j. t
  6. *! d5 T3 a4 L' }2 [" I6 _
  7. *   This file contains EDMA3 Test code.
    & U* A9 p8 t5 t0 s3 h: g% Y6 K
  8. *- {4 _% G: H5 F) p2 Q' R; O
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE% n# L7 K' Y% g( S, e; G4 B/ d( Q
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT8 a  r+ S7 L: q
  11. *         TO CHANGE.9 R* n' t0 d/ d; H
  12. *' [0 K. I( D  f& e! ~9 \4 A
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/8 V( `0 x) o6 j. l* Y3 t- L
  14. ** {6 g( [/ [9 W( m
  15. * This program is free software; you can redistribute it and/or1 ?# h! G" A. M& l
  16. * modify it under the terms of the GNU General Public License as
    ) j* n  T6 _5 v
  17. * published by the Free Software Foundation version 2.4 U, ~3 I% I- `  w% x* Y
  18. *5 Y4 r) M" c0 J# Q
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any9 s# g- A: ^% a; \% k" p
  20. * kind, whether express or implied; without even the implied warranty
    " _; E) G- K- k  [/ d: w; e
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the0 W- |- u, n4 o7 {5 _2 x$ E
  22. * GNU General Public License for more details.
    ! N( B' U6 Q" K5 k( a
  23. */* u" T% Y, s3 d- Y  [

  24. 9 f* T" z# r2 M. @. q- k/ e; }
  25. #include <linux/module.h>  J6 q4 e) N% ]6 E. `. `$ Y% [
  26. #include <linux/init.h>! g& ?8 r# A5 Y0 V( p' f' K
  27. #include <linux/errno.h>) P1 V5 w; x$ c% L
  28. #include <linux/types.h>
    * W  H/ A: r4 |% n' e
  29. #include <linux/interrupt.h>
    ' X& j) V' i4 F, t0 X* f# S6 n
  30. #include <asm/io.h>
    ; I" e+ ~- j: p6 m  V) U
  31. #include <linux/moduleparam.h>
    5 d; ^5 R$ t( B  ?; J1 }. c
  32. #include <linux/sysctl.h>& @' Y1 L: V! z( k; [/ e
  33. #include <linux/mm.h>! s9 l  R9 f2 V1 S
  34. #include <linux/dma-mapping.h>
    ' w2 b1 j* o; }3 G

  35. ( [0 ^; U) E- [( S' Y" G
  36. #include <mach/memory.h>
    - n* A5 C( i; v2 o3 X( h8 k
  37. #include <mach/hardware.h>
    1 ^1 r& I5 ?6 K! e
  38. #include <mach/irqs.h>
    7 s( x# t3 N5 k
  39. #include <asm/hardware/edma.h>
    4 _# H8 {8 z9 h1 W: ^5 U) I2 j

  40. 7 s7 J" J5 s- L  ~) V* S
  41. #undef EDMA3_DEBUG
    4 }$ }/ y, x: K/ Z( p9 z
  42. /*#define EDMA3_DEBUG*/3 U1 V4 N! ]# A0 L" d

  43. 0 H) Y6 i8 j1 B- X
  44. #ifdef EDMA3_DEBUG1 ]1 h+ J& B2 h& p
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    - e2 m; {6 J1 V
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)' M. @. _+ d. I! T2 q: c1 j
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)# o# }/ C1 t# D5 N
  48. #else
    & D/ e" V$ j3 X9 F, ^& S7 z
  49. #define DMA_PRINTK( x... )
    8 ?1 z9 h* ^- Q4 c. x
  50. #define DMA_FN_IN
    ; \1 Y9 X9 y& v" [
  51. #define DMA_FN_OUT% q$ o4 E% w2 i5 Y
  52. #endif
    % y. L5 @0 X5 l& ^/ A

  53. 9 ~* P# U! c) A% ~: `8 J
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    $ l0 w! t1 @6 J2 _2 Q" |8 x
  55. #define STATIC_SHIFT                3: T" |/ }8 `% t5 m/ `
  56. #define TCINTEN_SHIFT               20% _0 V# J  R. N! w1 {: i6 Z2 J- B- O% |
  57. #define ITCINTEN_SHIFT              21
    " e/ z) V+ M8 k: a/ @
  58. #define TCCHEN_SHIFT                22
    & p& o% \* S! J
  59. #define ITCCHEN_SHIFT               23, I1 q* r' D! Z1 j5 Q, \! u

  60. 2 C, [; A* F6 [. B3 Q% q) o- I
  61. static volatile int irqraised1 = 0;1 P! K- P$ `5 c# ~: V
  62. static volatile int irqraised2 = 0;
    ! O: o; E; X: ?% f# l3 u2 U# j

  63. ' M4 S/ U5 g; _. v+ L6 |
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);9 I- [; P  x" P# T/ Z
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ) |  E% g1 X! {4 J9 u
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);) F! E; o8 S9 F3 ~( s* h8 }; ~4 M+ \
  67. / B+ }; V! E7 r& y
  68. dma_addr_t dmaphyssrc1 = 0;: D" ]0 |* m# n( a
  69. dma_addr_t dmaphyssrc2 = 0;9 @: N% \' Y- H& g1 p8 R) Y
  70. dma_addr_t dmaphysdest1 = 0;
    * {! U5 k* [; q* p2 f, ]; M& x( S! R. @
  71. dma_addr_t dmaphysdest2 = 0;
    # n$ K/ F- M" ?1 x! f% v
  72. 2 B5 E( {6 A7 ~
  73. char *dmabufsrc1 = NULL;1 M  G$ b8 C0 S' E4 m
  74. char *dmabufsrc2 = NULL;8 i3 p. L+ V, b9 j: P' w6 S
  75. char *dmabufdest1 = NULL;
    2 V# n  ^4 n) L* S5 I* W$ _2 u
  76. char *dmabufdest2 = NULL;
    5 X0 s9 T! C0 V. I- S; q
  77. 0 l- q  ?7 u8 @
  78. static int acnt = 512;0 F3 f- B6 z2 |8 L( B' j* C
  79. static int bcnt = 8;% ?8 A+ q$ W: l2 W) M1 T' \& j
  80. static int ccnt = 8;( h2 `1 M3 a$ z
  81. 5 c8 S+ o$ J7 D# ?% U$ E) u2 R
  82. module_param(acnt, int, S_IRUGO);$ ~$ |$ K. u% V5 M
  83. module_param(bcnt, int, S_IRUGO);
    2 [! K$ w8 r( l& ~
  84. module_param(ccnt, int, S_IRUGO);
复制代码

7 y' u2 G' @9 g" E2 u) ]! K
* e* c  X- u( v! N' T      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
5 d1 {2 M* z0 B. q. N! m, iarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
5 Q9 s1 T2 b: y9 Z8 d; C     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。1 m$ M3 L2 M$ _3 d
8 l) E+ ^* c$ j* z( W# v# J

  ~& J6 F5 h3 s1 f4 b) y
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-11-26 18:00 , Processed in 0.037908 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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