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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 8 y. a) P, b0 z/ ?5 \* C  O
  1. [code]EDMA sample test application  X- c! r( f7 u: P
  2. /*& w0 B( C8 }$ i( Z
  3. * edma_test.c
    6 }3 z- R! i% N% b' _4 i' Y) |. T+ a7 B
  4. *2 l6 H  i; n9 c& ^" E9 H
  5. * brief  EDMA3 Test Application
    0 ^9 m) q% Y0 [' H1 @8 ~* [: ?
  6. *0 u# g- v9 {. k4 A1 \* w
  7. *   This file contains EDMA3 Test code.
    ; n, P( t! l, v6 `+ k, P
  8. *; W) T! e! k  u+ \, T
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE1 P0 ]$ A, ~. i/ @+ F
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    : H" w$ w# x( z# H* h3 p: {4 H
  11. *         TO CHANGE.
    1 V% [1 n/ y% d2 m+ }  x& W8 n
  12. *5 o5 @4 |' u  t4 l( _
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/0 U: H& h( D5 a2 M
  14. *
    2 P: m8 L$ r  ?- e
  15. * This program is free software; you can redistribute it and/or
    1 E8 L, H" v/ B+ M5 ]- ~, Z
  16. * modify it under the terms of the GNU General Public License as  G& P1 m! ?0 h9 r" Q- `
  17. * published by the Free Software Foundation version 2.
    - A9 Y6 u0 B! F8 p$ h4 U
  18. *
    * P4 a; D  p$ n: s$ p, O. }
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    ; B9 c3 A* C6 K5 G( M+ J- h
  20. * kind, whether express or implied; without even the implied warranty6 @* l  L) i" X( [* h8 ]6 ]% u# V
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    7 a4 y4 N5 ?  A
  22. * GNU General Public License for more details.0 }( k9 f: e* Y. e
  23. */3 ]( t8 V% ~9 r2 i' k
  24. 8 ?- T* Q. w: u' _7 Q+ h6 W( ~1 ~
  25. #include <linux/module.h>
    + ]+ c! B& f2 L+ B6 q7 X9 y
  26. #include <linux/init.h>
    3 F5 L( i8 J3 ~2 \0 L
  27. #include <linux/errno.h>
    - E6 Q8 q  a1 m
  28. #include <linux/types.h>
    ) g. r* F4 |& |: W/ [! P
  29. #include <linux/interrupt.h>( A. @  b5 O' M% B4 e. K& ~
  30. #include <asm/io.h>
    ; i! s, g/ f' \. l/ |
  31. #include <linux/moduleparam.h>+ A& z! M/ \: O8 k
  32. #include <linux/sysctl.h>  |  _0 Q# p3 i2 g9 l
  33. #include <linux/mm.h>! W) R1 n3 Z  `7 b
  34. #include <linux/dma-mapping.h>3 |* Q) q+ {- y# D/ ^; i! ^9 |8 W

  35. , U* D- y2 v: v6 o
  36. #include <mach/memory.h>
    ) x* ^4 D% y( y4 q9 l0 h9 V; w: ^
  37. #include <mach/hardware.h>
    ! E% K: V8 L- ]3 {
  38. #include <mach/irqs.h>
    1 ?0 W7 @7 Z6 L' P
  39. #include <asm/hardware/edma.h>7 w5 Y, ]5 F  f$ a
  40.   h- G' p- i  [" y6 U2 r
  41. #undef EDMA3_DEBUG
    0 v. }+ B( b3 ]( s* P) }/ J
  42. /*#define EDMA3_DEBUG*/; [) r( r1 j% S  S$ J; G+ T
  43. + s3 m+ s& j- @2 ]+ Q2 b- P0 S
  44. #ifdef EDMA3_DEBUG- \' W! w9 k: L
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    0 u( x8 R# C+ S3 i6 W# b
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    " Z$ w1 m" b6 W! d$ [
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)2 A, {; _$ U4 \$ R( ?3 Q
  48. #else4 j( {" b  l+ z0 B/ o
  49. #define DMA_PRINTK( x... )* C$ q  }* u! J2 |
  50. #define DMA_FN_IN9 Q: _$ {$ T; c
  51. #define DMA_FN_OUT( }( t7 ?' q9 V
  52. #endif
    / G, S6 T$ X% H% d% b
  53. 5 q9 E2 {: K- i) y5 Z
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)# r* {5 g# j; L$ ?9 o
  55. #define STATIC_SHIFT                3
    ) S0 h3 e# i, M6 h+ L0 p. G5 g
  56. #define TCINTEN_SHIFT               20
    / t4 e9 \5 T0 J- c5 a% u7 I" W. ^, ]
  57. #define ITCINTEN_SHIFT              21
    ' U) ~4 T  [1 i% u/ e2 q
  58. #define TCCHEN_SHIFT                22
    1 q6 ~$ _; ?- Z5 k
  59. #define ITCCHEN_SHIFT               23: j% D% ~' E+ a3 ?- i/ e& Y

  60. & ]+ p; ]5 _. G& j- d
  61. static volatile int irqraised1 = 0;
    ( N! u" b5 w  _& V
  62. static volatile int irqraised2 = 0;# {% P4 d# l, b3 s1 }

  63. . s% U0 f% A! \+ J: c1 Q- B0 u
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    - m/ j& k  x4 O$ U. q6 |- z
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ) ]6 D. ?( o1 j: B' T0 f2 Z$ G2 o
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ) ~8 ?" p; d4 |9 B3 @
  67. * {. B2 e( i& x. Y( i
  68. dma_addr_t dmaphyssrc1 = 0;
    4 M& V: {6 ^4 F! h0 a
  69. dma_addr_t dmaphyssrc2 = 0;
    ) a% S* X1 e6 N. G9 B* a
  70. dma_addr_t dmaphysdest1 = 0;
    % i/ b! a5 _8 L, ~7 }
  71. dma_addr_t dmaphysdest2 = 0;0 {7 L. S5 t- t, S6 S( V
  72. 1 a2 A: S& Z7 ~! p
  73. char *dmabufsrc1 = NULL;
    % ^& v% D2 x$ ?6 I& m2 j9 a
  74. char *dmabufsrc2 = NULL;6 u1 R4 z0 @, V# E( m
  75. char *dmabufdest1 = NULL;; Q( P7 S3 L5 d
  76. char *dmabufdest2 = NULL;  N% X1 e7 b; t7 \* W  x( q

  77. % m; O" P+ {5 P. |  y2 k
  78. static int acnt = 512;
    6 ~9 H- e' Q( s( H6 y3 t; \, Q( j* m
  79. static int bcnt = 8;
    * H* k( x: @& d/ b
  80. static int ccnt = 8;
    0 b2 l" Q9 l1 `; t* k0 ]

  81. ) u( ?4 ]: O" J4 q- v
  82. module_param(acnt, int, S_IRUGO);
    & A/ P' @/ z+ W* q* e
  83. module_param(bcnt, int, S_IRUGO);
    : D, m8 b0 O) w% [: F1 |. ?1 E0 H
  84. module_param(ccnt, int, S_IRUGO);
复制代码

) ]. ~" N; v, u% S/ ~; S8 v
5 G! A3 i3 E0 U1 ~2 i  y      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用5 r' @6 s9 O. |1 J& L, `6 E* I
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。* P7 @/ r& K+ M1 J* w. f9 K8 D
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。6 |9 T* W; }7 X+ k0 T/ ^
3 l, a8 \8 d: K) w5 B
1 `0 G8 f( b# c9 A
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-2-26 15:40 , Processed in 0.046051 second(s), 28 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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