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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |正序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 " s( H4 q4 O! y2 v" Z
  1. [code]EDMA sample test application
    ( k% S) }, o  C* j
  2. /*7 c  {  |8 r& {) E6 K
  3. * edma_test.c
    1 w) m! w6 Z" ^
  4. *1 Y# V( `  `1 v/ \# `5 V, E. d' R
  5. * brief  EDMA3 Test Application
    7 ^( g7 l% H$ W1 y" |
  6. *% A, D( V# Q  J' p7 Y- J6 A9 K
  7. *   This file contains EDMA3 Test code.* _/ V: M4 h1 d1 x" v
  8. *0 p- k8 E' p: s6 C2 r+ v
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE7 n% l; |; `+ k8 y0 ~3 D9 o. L
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    $ \- D( `9 n7 Y; ^
  11. *         TO CHANGE.
    & @9 w% z# q# P( x4 l8 k+ d
  12. *, C) t" M4 }2 J9 a0 E7 A) a* j
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    ( B& B- p6 e& F- m
  14. *1 ^8 P: r! y( j' x2 X3 \" w
  15. * This program is free software; you can redistribute it and/or
    4 K  Q6 A' @" O8 k- Q* l- w8 w
  16. * modify it under the terms of the GNU General Public License as# t; s: C. y: u1 k2 b( C8 g
  17. * published by the Free Software Foundation version 2.5 Q+ x% N$ h$ A8 c) g5 e8 k
  18. *
    : N: b* W5 f$ I7 \- @: N$ S7 g
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any3 r) j9 J% C: h/ p, a6 o
  20. * kind, whether express or implied; without even the implied warranty2 \9 e) c' z. i9 i* f( ?
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    ; J  i8 B% `9 B' V! T
  22. * GNU General Public License for more details.* i6 D! `# }2 E- x* Q  e& K, A/ F
  23. */
    , b9 J1 g! B( P9 O( m: M5 {

  24. # ], n; ^& }6 M; y/ {
  25. #include <linux/module.h>2 `4 Y0 _5 Y! W6 u& s# m
  26. #include <linux/init.h>
    1 z( a9 n. ]" ?; T, U
  27. #include <linux/errno.h>
    7 j1 p1 X) H; r6 c6 D
  28. #include <linux/types.h>
    & U0 A6 D- s+ ^  F9 ?
  29. #include <linux/interrupt.h>
    7 x4 R$ G& v* `& R, d; I& |. ^
  30. #include <asm/io.h>! {$ ?. `* b* P7 S
  31. #include <linux/moduleparam.h>
    $ S, |  V6 y8 X
  32. #include <linux/sysctl.h>) j5 `" n& m  W
  33. #include <linux/mm.h>8 Z, C& J+ S) b
  34. #include <linux/dma-mapping.h>
    / e" k% z: E7 M( T( ?5 C) w

  35. 7 e9 V( _3 y6 N- Q% |, n
  36. #include <mach/memory.h>6 H1 d( \7 k6 P9 \2 c+ I
  37. #include <mach/hardware.h>' G+ v6 |' z. C. V2 {
  38. #include <mach/irqs.h>+ ?  p8 k  |! q2 V
  39. #include <asm/hardware/edma.h>
    0 r# w# U, r1 Z
  40. 8 ~& Z$ w) x* F% k
  41. #undef EDMA3_DEBUG5 [2 g0 u4 L4 b
  42. /*#define EDMA3_DEBUG*/
    2 I9 T! Q% f8 Z$ y; D8 f3 ?

  43. % D1 G; s8 i/ N
  44. #ifdef EDMA3_DEBUG2 H! G0 i$ q8 W  l% Y% v- Y
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    7 k  z( V6 |5 t$ c" l$ c4 l
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)' Z0 H0 |. H  R+ |
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__), R4 ^# G* l, t( h* [5 `
  48. #else1 }( e) T2 O% R( ?0 q; s) Q
  49. #define DMA_PRINTK( x... )% V7 h$ t& U  e3 h
  50. #define DMA_FN_IN
    5 w. D/ a3 L; Z8 R" ?; ?' O
  51. #define DMA_FN_OUT
    - @4 v4 ^  I( P3 c6 ^/ m3 y' w4 }
  52. #endif, X$ S5 c% k  T  d1 N* N: S
  53. * U9 o  Z! x& V/ f( m
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)5 b" \" ~+ C- b. F7 a
  55. #define STATIC_SHIFT                3
    % O8 c# D1 A1 @) ]) l
  56. #define TCINTEN_SHIFT               20) O$ |, I5 @  ?; V) R. j
  57. #define ITCINTEN_SHIFT              212 m1 S3 @& u2 O
  58. #define TCCHEN_SHIFT                22
    . b! a- f. z/ I% h7 p
  59. #define ITCCHEN_SHIFT               23
    9 N' Y: |& ?( O0 G" v

  60. & ]: @4 J3 y' M" d+ Y" _
  61. static volatile int irqraised1 = 0;
    * s1 D$ S8 a5 h
  62. static volatile int irqraised2 = 0;
    & q' B6 v+ u6 Z3 g% K% e0 g

  63. ) }# X' c  y- K- Q( y# T
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);$ G  q6 k! C% r8 O, W
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    + v6 U/ q! \% }* [) h4 T( Y
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
      ]  W6 x# f/ K

  67. : J" r1 t; o( e$ v7 B7 T) h- j/ L* K# {
  68. dma_addr_t dmaphyssrc1 = 0;
    . z0 E5 O3 z/ l
  69. dma_addr_t dmaphyssrc2 = 0;
    3 f; ~4 J1 f% S4 g
  70. dma_addr_t dmaphysdest1 = 0;
    & C% S, D2 T  t3 |% q
  71. dma_addr_t dmaphysdest2 = 0;% R8 Q2 f! z/ C; G

  72. / B  b5 ?' b" O$ P  j0 i2 J8 P+ V+ h
  73. char *dmabufsrc1 = NULL;# H& ]1 B2 D0 t( e0 c
  74. char *dmabufsrc2 = NULL;% N& ~/ o6 t$ _
  75. char *dmabufdest1 = NULL;" f/ R) c7 I! |; \5 \) U, w2 _' J
  76. char *dmabufdest2 = NULL;- G# K' ~% M1 a
  77. - A5 g2 K3 ]1 _. }: e
  78. static int acnt = 512;% I% _4 V! S9 l- @% Z
  79. static int bcnt = 8;* E* R  b" e# d. F- r( Z% ?( ^
  80. static int ccnt = 8;; ~) V0 B& L- @9 V+ @

  81. , |- v1 P4 y( Q2 s% g& ?
  82. module_param(acnt, int, S_IRUGO);
    8 a$ a4 t! {* J+ V
  83. module_param(bcnt, int, S_IRUGO);9 q% K9 t6 F1 P+ ]9 j& S" |% C
  84. module_param(ccnt, int, S_IRUGO);
复制代码
+ Y3 M; F, {( }' t6 h

7 C6 ]/ r" y+ x" T1 \      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用, D' D; W% `! @  r/ Z* u
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。. c& W/ i8 f' l4 L& X+ K: S
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
! j2 V+ P. g7 p" b
' L5 X9 Z, V9 ]3 ~6 j6 S# S. g$ t$ Z) u7 I- d. M6 ]  E: z* ~
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-4-2 02:36 , Processed in 0.038910 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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