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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 ) @. e$ }. w3 l3 q
  1. [code]EDMA sample test application( |* j4 z  ^+ f7 F
  2. /*; }: q: C2 p$ i3 {$ L2 J* ^) t
  3. * edma_test.c
    # x, ?! q! i9 `, q' b" [
  4. *
    4 L$ X4 K" H( L( R* ~4 L' w
  5. * brief  EDMA3 Test Application3 t+ s0 w0 ?% w9 k& i2 U1 o) l
  6. *
    ' G" t+ c  V3 w: u
  7. *   This file contains EDMA3 Test code.5 {: O: X5 }; j- R7 P& h, M6 V
  8. *( i$ {, h4 l, T  @) D2 L) `0 I
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    6 H; R" [5 q. O  W! R! j! q
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    9 t( N3 @. c9 t; N' Z  h
  11. *         TO CHANGE.- W) a9 T. E2 P8 {* G
  12. *
    2 I5 R* @8 n5 Q" T
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/  W  I: G& E5 c. }8 {
  14. */ E: t# p) s" ?0 S
  15. * This program is free software; you can redistribute it and/or
    * `; i' c1 P1 V- F7 W
  16. * modify it under the terms of the GNU General Public License as- D8 O1 k" N. y# i9 _$ G  x+ j
  17. * published by the Free Software Foundation version 2.
    ! U8 e  V4 M9 }  m8 @' W
  18. *
    & x9 W, i, n  F* Q, L, v2 o$ \
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    + T( I( F2 P3 ]: k" _) ^/ y
  20. * kind, whether express or implied; without even the implied warranty9 ?2 U: A3 R7 I% I) R9 t2 y
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the2 Y/ }$ {* Y; r' F$ b
  22. * GNU General Public License for more details.% g4 l1 U5 B4 F$ i, G1 m
  23. */
    4 j# E: e3 B5 K% M

  24. ' Y4 q7 n0 U- J8 t% S- T; |0 q
  25. #include <linux/module.h>5 [2 k" a/ D9 d' w/ o$ O4 o
  26. #include <linux/init.h>
    " E" c6 r: K% d" m9 c8 U2 L6 S$ f
  27. #include <linux/errno.h>! _2 W! @4 w9 g: K4 e
  28. #include <linux/types.h>& x: x- g: X" n
  29. #include <linux/interrupt.h>4 N& c: s. r; ^8 V6 k8 h1 ]
  30. #include <asm/io.h>
    3 V, J, A% n& W& E& d  R4 ]0 W
  31. #include <linux/moduleparam.h>
    3 d& W' H6 C; Q  y; x. ]
  32. #include <linux/sysctl.h>
      b1 a7 x4 G) R9 w' P
  33. #include <linux/mm.h>5 F1 ]/ I9 O2 p, e: Z# p9 ^% H
  34. #include <linux/dma-mapping.h>
    & P" L- m2 ~) a" D# O
  35. 1 |0 j, z- K. O! K1 C  Q8 |& L
  36. #include <mach/memory.h>- e& S1 J/ g: n1 {
  37. #include <mach/hardware.h>" w" [2 n$ u. d) q- X
  38. #include <mach/irqs.h>
    1 ?2 b7 L/ {( r- O
  39. #include <asm/hardware/edma.h>
    1 o1 I+ y0 f9 r2 I2 B( J3 a
  40. : `8 [8 d4 \. a- X
  41. #undef EDMA3_DEBUG
    # H/ B0 M" v3 [- t
  42. /*#define EDMA3_DEBUG*/+ J  f# y* W% c, y' A

  43. 4 ]4 V1 P4 T( ~. @4 w! s6 J
  44. #ifdef EDMA3_DEBUG) \2 v, o  T0 G9 p+ d. F/ O/ ~1 r
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    % W$ q9 e; G- h- `$ d3 m$ c
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__); [, {& U) r% c3 ]" [
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)0 b$ n' C3 x9 X1 Y# f# D6 B
  48. #else
    ( L7 n( g/ K9 S& [% J7 h
  49. #define DMA_PRINTK( x... )! s+ g# F" n. \* x( s
  50. #define DMA_FN_IN
    . W8 X2 T6 `' y) k  d" M9 W3 W
  51. #define DMA_FN_OUT+ L* h2 o) U6 A9 l; F. @+ J7 I6 K
  52. #endif  R( [8 P( q% ~3 [6 B0 L# ?
  53. 9 O: Q. I/ H. z( s
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    0 j: V4 O! U8 H9 k+ {1 H" k9 ~2 B
  55. #define STATIC_SHIFT                3
    0 u. m* S4 A' j2 M
  56. #define TCINTEN_SHIFT               20& F7 {) v' o' J. E0 h( o0 v5 o3 N
  57. #define ITCINTEN_SHIFT              21
      p, M: o! g( D  Z% a# U- u. F
  58. #define TCCHEN_SHIFT                22
    4 @1 D* ?( p% w: A, Y, _$ e. J7 S- W
  59. #define ITCCHEN_SHIFT               23
    0 L& y/ i  k; S/ H# m

  60.   s+ q  i  u$ Q$ B7 ]/ k+ `1 a
  61. static volatile int irqraised1 = 0;: A7 h2 {; m- `6 Q3 U+ \- x) h
  62. static volatile int irqraised2 = 0;8 P, W. N/ X3 r9 x& P
  63. 8 j4 f3 \$ f( P  b6 C  X
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);  F3 b5 Z& E; @/ ?$ U' y
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    4 b1 G9 \! l4 l9 n# x3 S; \
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);7 d; ~! I) t0 W. {' h7 G

  67. . g4 c  }0 ^+ L# p7 H
  68. dma_addr_t dmaphyssrc1 = 0;8 G& C7 E7 a( a
  69. dma_addr_t dmaphyssrc2 = 0;3 \3 G3 u: S, e* h1 G4 d3 g+ N7 T
  70. dma_addr_t dmaphysdest1 = 0;
    $ ^% C" X$ u  q
  71. dma_addr_t dmaphysdest2 = 0;. K# h( z/ {' M- m0 t
  72. 6 X! V% G9 o- Y# n3 H6 n1 S' l8 D
  73. char *dmabufsrc1 = NULL;
    3 v& \- ^: V' l$ I
  74. char *dmabufsrc2 = NULL;
    * r' B7 I5 G- Z* N& b2 R
  75. char *dmabufdest1 = NULL;+ }+ q" Q' t! h" ?  C/ h1 r# D0 |* z
  76. char *dmabufdest2 = NULL;$ P* H) S+ f) \* L" l9 R6 y

  77. . u* j  I1 U( E
  78. static int acnt = 512;
    , S1 r  f1 F5 l7 _
  79. static int bcnt = 8;
    / o' u6 o& o; [6 D% a' W
  80. static int ccnt = 8;4 P' ?8 W- x2 m

  81. & X' f5 Q" W9 j; Y  {) i6 w
  82. module_param(acnt, int, S_IRUGO);
    5 v$ C! |2 `1 u. R) E
  83. module_param(bcnt, int, S_IRUGO);  i! s! L- Z) P5 t2 _; j4 K
  84. module_param(ccnt, int, S_IRUGO);
复制代码
3 H+ I3 G5 S. H4 F( t
1 ~' f2 P! N2 v
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用4 d- ~3 {) @4 B' L/ {
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。6 R, N& G- }: y$ |- {1 X3 P3 o* G
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。) e) i- a3 Z; O( {

- [+ [  ?4 D6 l" X+ z- ]& y# m( c- E7 G1 }9 {, f, Z9 L  F
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-1-15 12:36 , Processed in 0.040086 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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