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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 & q* _/ Q: h  L
  1. [code]EDMA sample test application( J8 m: I) F0 N2 g3 P$ v* D
  2. /*
    " e! ~) \* w1 x+ @  q
  3. * edma_test.c
    " @: C- V+ J5 e) `9 T3 q
  4. *
    - C0 L6 R! o1 g3 R1 j
  5. * brief  EDMA3 Test Application
    3 g* Y$ E7 y9 R* w9 ~; ~! u5 U
  6. *. _/ m" G6 y# F: z3 Z
  7. *   This file contains EDMA3 Test code.
    ) B9 H! ?1 x* U
  8. *
    8 d/ Y! m0 o4 k( j) w
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    , J4 q, H4 R% C- l& b5 |5 u
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT+ ~- r$ X6 B2 F3 S7 M
  11. *         TO CHANGE.
    / Q* @4 T; }' c; A: H
  12. *
    7 t$ T6 V( p1 j
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/$ d2 Y# Y" R, I$ D
  14. *) o+ e! M+ l1 m7 ~
  15. * This program is free software; you can redistribute it and/or* D, }7 t- J7 c+ t6 ^. W
  16. * modify it under the terms of the GNU General Public License as2 _. }. i' H" s/ ?
  17. * published by the Free Software Foundation version 2.! ?  A/ S. U8 o8 v+ `
  18. *
    2 o* R7 J$ f9 v. n# O  _4 X5 T
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any) ~7 J5 @( F. Y
  20. * kind, whether express or implied; without even the implied warranty5 V, J4 J3 x1 r/ I6 {
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the( x; |4 h# s: `* [  ]; F
  22. * GNU General Public License for more details.8 @6 A3 r% x2 X* P) i
  23. */& ~, F' X9 J! T6 \0 y

  24. " M+ U' b3 m. C7 K6 o
  25. #include <linux/module.h># `4 _' w  O$ V" z- c
  26. #include <linux/init.h>
    & u6 k# ^& T( b( c* {1 @7 ^$ n( f# H
  27. #include <linux/errno.h>
    + o/ J- [4 N, f* N# |0 G
  28. #include <linux/types.h>
    2 G% [" M( q3 |( |
  29. #include <linux/interrupt.h>
    2 j) x$ d+ W5 f* y
  30. #include <asm/io.h>. Q1 U/ U6 }% |! A6 G2 q& V
  31. #include <linux/moduleparam.h>
    0 D! ]  L7 p& |# D9 A' @
  32. #include <linux/sysctl.h>
    / @* n" g  J& a; h% @
  33. #include <linux/mm.h>
    1 ]5 X  T- E1 k
  34. #include <linux/dma-mapping.h>
    9 w# O4 D% l2 }5 J- p6 V8 U# Y; V

  35. ! [4 `1 r3 r& ]! K
  36. #include <mach/memory.h>
    8 f: v' g" W! Y! S. Q
  37. #include <mach/hardware.h>( r5 G, [! G4 r) B3 I5 T/ B& X
  38. #include <mach/irqs.h>% [" ]6 N6 {4 N: M! z
  39. #include <asm/hardware/edma.h>
    3 l5 F! ]' R0 L% g1 d; Z& p3 j, `

  40. + u- o' ]8 k9 t4 N
  41. #undef EDMA3_DEBUG$ ^4 C0 F! R" g# {) X
  42. /*#define EDMA3_DEBUG*/: c! Q2 O2 f3 P+ }+ U
  43. % J4 [) k7 C; C
  44. #ifdef EDMA3_DEBUG9 q- ?! x0 a9 ~+ v* L, O
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    " z, p4 U" H- n! t
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)  a# |. Y/ y- G! o
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    : M5 Z! {4 V3 `
  48. #else6 |- o+ F5 T1 g( X0 {6 r
  49. #define DMA_PRINTK( x... )
    $ N' f* v8 i. }& z' c+ a
  50. #define DMA_FN_IN& O, E% }+ y6 s9 o
  51. #define DMA_FN_OUT3 i# J4 ]1 [8 j, S
  52. #endif
    0 j) G9 f! o2 M" g5 W* ]
  53. 9 F) x& W& J5 c( r( R. E3 Q5 s/ f
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    8 o5 K+ [/ I. g1 S$ g8 s0 h, O
  55. #define STATIC_SHIFT                3
    $ [* d% Y0 c$ l$ c9 }
  56. #define TCINTEN_SHIFT               202 n  g3 A( Q6 {3 h: s3 S) w* k7 H* \
  57. #define ITCINTEN_SHIFT              21, d/ F9 h" y' G7 r) p
  58. #define TCCHEN_SHIFT                22
    9 N" {* j7 T/ |
  59. #define ITCCHEN_SHIFT               23; s( }0 T. }6 o/ i3 F, u, j9 N
  60. 6 i; D6 `1 V9 ^. s
  61. static volatile int irqraised1 = 0;4 }0 k) z( W( x0 S# _5 z- v
  62. static volatile int irqraised2 = 0;
    ; @7 z6 Z4 }, v1 I9 U4 n  f

  63.   ]5 h; ^9 U' c8 d- N
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    % I# q$ p' K% k1 Y" j, M% e" D
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);" L3 w/ j: T. U2 i+ p
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);2 o$ d! B% u9 a% M) U; F6 y

  67. . m" L. r" D% D* k
  68. dma_addr_t dmaphyssrc1 = 0;$ V9 i, u: K, t0 B: C# A
  69. dma_addr_t dmaphyssrc2 = 0;0 A' w. W! j$ f( }" G& }+ H
  70. dma_addr_t dmaphysdest1 = 0;
      u) R! I. q! W) ^7 w) y
  71. dma_addr_t dmaphysdest2 = 0;- \6 n7 G* g2 q: g( _5 ~  {
  72. , ]& q( S3 i9 ?
  73. char *dmabufsrc1 = NULL;7 i) l, {, G9 ~% V2 c" q8 Y. r
  74. char *dmabufsrc2 = NULL;
    # a4 U' \8 l5 c2 B/ q* }) L. X
  75. char *dmabufdest1 = NULL;" z( N2 K+ G# e! U8 v% c8 _; F) x! i" i
  76. char *dmabufdest2 = NULL;. ~. A; A$ s! I- P

  77. - C( `  w. }2 t8 P4 x" E0 x
  78. static int acnt = 512;- o& W8 z( ~  Z" R( T& f
  79. static int bcnt = 8;1 E9 ~* w3 O6 C
  80. static int ccnt = 8;5 L9 [) l$ x6 J" \
  81. / l0 l' g6 K* Y! q+ S4 [
  82. module_param(acnt, int, S_IRUGO);! F% R# o) o, |' `- n, D6 g
  83. module_param(bcnt, int, S_IRUGO);
    ' }' N. U2 r( @$ w
  84. module_param(ccnt, int, S_IRUGO);
复制代码
3 Z# y) A' L3 F. M0 Y2 e3 G
4 G- g: b9 ?1 m: w
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
5 }' Q4 l4 f+ y3 w0 jarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
* T$ Z/ M, T. o! X6 ^) X$ K     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
5 f) }- x+ Z& S7 y( Y& e3 L8 L: U
! S* ]0 h/ ^  ?- ~5 m6 N- n% S$ i5 d$ I$ h9 U4 b( Y
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-3-4 01:44 , Processed in 0.039636 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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