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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 / |& E- C- y: G% v: N- [; U( R' l$ W
  1. [code]EDMA sample test application  }, N2 \: g0 ~
  2. /*% n5 z+ H9 V6 [  q9 f. z8 _" W7 ^
  3. * edma_test.c
    4 r0 }' V( D% d8 s2 z
  4. *
    , C  H7 O* Y: l( o; ]( B+ [
  5. * brief  EDMA3 Test Application
    - D6 D' Q; V. H" z7 n' U# U
  6. *
    & v6 m( v2 l1 R: N4 X
  7. *   This file contains EDMA3 Test code.
    2 j, h# y/ \; l8 e" `
  8. *7 J3 b6 h( E' @
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE9 h, l  A: G* B5 u
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT1 V$ [, i1 ?: J( p
  11. *         TO CHANGE.
    $ X( K, X! g0 p' m+ ^
  12. *& R/ f/ R& N5 ?# y6 ^' }* j$ }, C, [3 M
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
      U5 ~  E& e8 y6 n; j8 c# ^
  14. *( B/ Y" I6 e' z" H+ m0 s* O2 }
  15. * This program is free software; you can redistribute it and/or) D/ C  U0 R3 o
  16. * modify it under the terms of the GNU General Public License as
    : Q, Q& E7 j/ R0 }2 T" u7 D) T, C
  17. * published by the Free Software Foundation version 2.) k* ], a8 e4 C  J0 a  B
  18. *
    ; t1 Q& L5 O; Q) t+ [
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any' j# V. }5 A' I6 l2 r$ v
  20. * kind, whether express or implied; without even the implied warranty
    ( N9 K! n5 ?6 S" ]3 E& J3 H0 w
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the* f5 T( E: `4 x( V
  22. * GNU General Public License for more details.8 e* U' b" C) j& U. s( u
  23. */& b! q/ `, d; n' R. i9 |
  24. * Y- l, q! O2 y0 J
  25. #include <linux/module.h>
      }& P! a! S$ W* C1 V4 |/ l
  26. #include <linux/init.h>- [5 M$ y) Y9 k3 G8 \( _4 s5 [; b
  27. #include <linux/errno.h>
    4 Y% y9 L' F( A$ l$ n
  28. #include <linux/types.h>
    9 `5 Z( D; n5 Q+ h" \. J: Y: K
  29. #include <linux/interrupt.h># b, D5 U) H6 i+ \! E# o
  30. #include <asm/io.h>
      ~3 U0 ]  q$ I% d
  31. #include <linux/moduleparam.h>6 h; r5 z/ H1 Q7 ^' c
  32. #include <linux/sysctl.h>, C. _) p& c! o
  33. #include <linux/mm.h>
    ! ?& `' i2 G. m/ X( Y7 B
  34. #include <linux/dma-mapping.h>- T% _6 I  h: M6 o6 A- |7 s( T# V7 S1 I

  35. . E# M" C7 a; e7 S3 f" e, }/ |
  36. #include <mach/memory.h>
    / z% `, r9 r9 A5 D- W/ U
  37. #include <mach/hardware.h>
    ; M( y5 ~7 N- B) g( C( C
  38. #include <mach/irqs.h>
    , c3 V. l) c8 B: H3 p- F
  39. #include <asm/hardware/edma.h>, D9 }9 r, s! E

  40. 1 }5 N3 ~! i+ o8 w
  41. #undef EDMA3_DEBUG
    - H' U9 }2 s: ?9 O( N# C
  42. /*#define EDMA3_DEBUG*/* i/ B! D6 o) M* x
  43. ( q! A5 L3 g/ b; E& c! a( R
  44. #ifdef EDMA3_DEBUG0 a( y. O! ]* l) q- s5 F- m
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)( ~+ [& v8 z8 \: J( @
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    ( h# |: U$ g+ M0 @4 o
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    % e4 d' F" _9 h/ {! Q- ]% J0 ~( n# ~
  48. #else
    & |& S0 [- X3 y' Z
  49. #define DMA_PRINTK( x... )) n: Y/ S; a- _$ [7 {" r% U
  50. #define DMA_FN_IN
    3 z+ ]! s" u! y, G. ~  e9 x
  51. #define DMA_FN_OUT
    5 U1 v0 h( `% c& i
  52. #endif  o$ i  V7 Z+ ?0 l! K* Z
  53. / X0 z' [) y+ N( ~) H: W
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)2 e) j* t' Y1 R  V$ s6 a+ M
  55. #define STATIC_SHIFT                3
    ' v0 k; S0 c! ~3 ~9 a# v
  56. #define TCINTEN_SHIFT               20# Z. z! n) r& a) @
  57. #define ITCINTEN_SHIFT              217 C: R/ n1 T  c
  58. #define TCCHEN_SHIFT                22+ |5 d: a4 D7 Y+ Z" i; F. M
  59. #define ITCCHEN_SHIFT               23$ E2 ^, o. H  M, A1 f1 R. R5 T
  60. % J3 R! M. L5 O
  61. static volatile int irqraised1 = 0;/ m' E. f4 {/ ^' |* P$ N
  62. static volatile int irqraised2 = 0;
    + k# i2 ?' n6 j1 Y; [- P' R3 z
  63. & L9 k/ c8 y$ v: b- O6 \. z2 J8 G
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
      J; L0 h# K$ k5 }+ l1 D
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ; \  z' \3 h% _% y
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);/ w- i' T/ r  U' d

  67. 8 Z" \6 h; Y! s3 s2 Z
  68. dma_addr_t dmaphyssrc1 = 0;& m0 @, S$ ?+ ]$ r1 A
  69. dma_addr_t dmaphyssrc2 = 0;2 E( r: ]0 C9 V' ^3 k
  70. dma_addr_t dmaphysdest1 = 0;
    " j( b' x+ z" r9 ]) q
  71. dma_addr_t dmaphysdest2 = 0;7 G/ Z. ?) x& C6 {. y/ A* \

  72. 8 T2 x4 A; U$ p, \# G
  73. char *dmabufsrc1 = NULL;# g# R. [. _7 T7 z- _% x
  74. char *dmabufsrc2 = NULL;
    , p0 \+ J9 ~/ Q$ S, Z
  75. char *dmabufdest1 = NULL;
    3 A6 U8 V1 ^- w- t0 P
  76. char *dmabufdest2 = NULL;; M& E+ q6 ?3 B0 }1 _# r
  77. 2 B  J2 ^5 j# }- j
  78. static int acnt = 512;" Q# E- W% u. Z9 Q
  79. static int bcnt = 8;
    " W; W; H: ]9 D5 Z' J! j. D
  80. static int ccnt = 8;
    $ B: x, X3 a: J

  81. ; G; f; a4 q; U" \$ N
  82. module_param(acnt, int, S_IRUGO);; ]1 ]* O9 a1 s: _
  83. module_param(bcnt, int, S_IRUGO);
    4 l, Z, V4 i" @
  84. module_param(ccnt, int, S_IRUGO);
复制代码
3 `0 J6 e6 r1 W9 [# t( f- I
4 y& s% b3 P( l- G5 I) y! g
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
& W4 m2 N6 ]5 n+ L$ Q/ c% harm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。; P2 J4 \/ i% {1 _. b
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。9 T! z  \( a3 {1 u3 M

3 R& A& H" Y+ {2 C7 p& d. X1 b" P4 ?$ i( L! T2 o
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-3-1 01:35 , Processed in 0.040601 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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