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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |正序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 : M5 W( T' C# m1 l2 H
  1. [code]EDMA sample test application5 }" }# q3 \$ O$ _  m6 w5 v
  2. /*8 ~' ]) Y" |1 j! p1 _
  3. * edma_test.c
    ; w7 L( H) G' N+ j: P5 s& V$ E7 o
  4. *
    * q* C! \- d0 r8 Z& V+ L) i
  5. * brief  EDMA3 Test Application
      V6 O' Z# e. T# ?2 }0 V
  6. *' o9 C: J: D7 Q  H+ _  R
  7. *   This file contains EDMA3 Test code.& `3 U7 @9 I, Q+ J: T9 T
  8. *9 }) v2 {& {! O
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    5 g7 ~* x/ Z( K+ n
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT1 v: ]0 }. w% z" Z3 P, ~: ?. D& Q
  11. *         TO CHANGE.2 K) q2 |9 x: F6 H  ?! D+ `
  12. *) G. Y" L2 w% C' B6 i: w" @; |
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    + o+ A' |- [+ W! H
  14. *
    . u$ _; M+ l! j; \, f0 L! ?/ U/ A0 n3 D/ b
  15. * This program is free software; you can redistribute it and/or
    ! M- g8 Y% W) M% v8 ?4 A
  16. * modify it under the terms of the GNU General Public License as4 b/ B4 ?, P+ k: S9 j: {
  17. * published by the Free Software Foundation version 2.
    ) ^7 z6 }8 z; y' Q$ l
  18. */ |/ i7 b7 {, B1 U6 O
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    3 D9 a# W8 L* z7 a4 N% u9 ?- g4 a$ s
  20. * kind, whether express or implied; without even the implied warranty
    , y8 X) Z& s4 l. p4 W* h$ [
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the- B" c' K5 K+ J5 [9 y: G# }
  22. * GNU General Public License for more details.
    ) k0 G' ~2 i" J4 F$ N9 D
  23. */( X# R6 U) t! J, g7 k; u4 i

  24. . Y0 y; ~& r3 ~9 w" G+ A' e* B
  25. #include <linux/module.h>! k4 ^" f& @3 C* H( ?0 p7 T# H- z: [
  26. #include <linux/init.h>
    6 M: g# E- l0 _
  27. #include <linux/errno.h>
    - G% |# l+ H2 k, F2 d
  28. #include <linux/types.h>
    $ w/ |8 _: ~  x  z' Q$ L
  29. #include <linux/interrupt.h>- W) o5 M# o5 d) ~3 k
  30. #include <asm/io.h>) F) ?( s# s0 E& Q6 Z+ V1 q
  31. #include <linux/moduleparam.h>
    / y! x3 [* T! p# j- n
  32. #include <linux/sysctl.h>
    ; h7 F; f4 x6 j' @1 S( t
  33. #include <linux/mm.h># ^+ Q* F5 |" K1 o( P
  34. #include <linux/dma-mapping.h>
    3 h+ f( b) h# u( n1 g1 n

  35. 3 {5 z- Y. J) M5 |5 b7 v
  36. #include <mach/memory.h>4 b/ g5 H( S. g0 N; a
  37. #include <mach/hardware.h>
    - t) s3 I3 ~- d# O6 e. D* Z
  38. #include <mach/irqs.h>
    : ?+ ^4 A/ {( Y6 r1 P7 ~
  39. #include <asm/hardware/edma.h>+ N0 b- i7 \% V

  40. 2 n: ]: S2 A/ a. C. p: k
  41. #undef EDMA3_DEBUG4 {, D# L( y6 g: }9 d6 R( y
  42. /*#define EDMA3_DEBUG*/% c! g) d$ C/ z, `  v, l
  43. 8 l7 l' p. Y! g3 S
  44. #ifdef EDMA3_DEBUG* ~0 s) t8 z, T
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)8 j, i5 L6 D9 ?/ C" }1 X' A0 j
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    0 \( D5 l7 z0 E6 v" |
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    & i( J& g" b6 `) J
  48. #else
    ' J9 }* R3 W* Z" e  c: M
  49. #define DMA_PRINTK( x... )3 N7 m9 ?3 G0 ]& q7 c( Z+ X+ ]
  50. #define DMA_FN_IN5 V( l+ h& _& ^  a$ b3 d$ j3 {
  51. #define DMA_FN_OUT
    + a0 F+ a" F+ s; l) f0 V
  52. #endif( B2 i% L! [# E1 H
  53. 2 B5 Y- o3 N# c
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)5 I- [; t# V' ?2 {. c9 l
  55. #define STATIC_SHIFT                3
    - ^- Y% U% r2 z0 e. e) b
  56. #define TCINTEN_SHIFT               20$ k- o0 N8 R( X) k
  57. #define ITCINTEN_SHIFT              21
    ) {( M! L9 Y5 h3 B% Z1 F, `
  58. #define TCCHEN_SHIFT                225 p$ ^, G2 A/ x5 }
  59. #define ITCCHEN_SHIFT               23
    " B" `# B) \+ M( p+ q# v
  60. 3 z, V; K5 E5 m" ~$ F( d$ M: u2 ~
  61. static volatile int irqraised1 = 0;
    1 O3 F0 f" F! _; S9 {
  62. static volatile int irqraised2 = 0;
    ! V' @5 n& c$ F# J) U8 p

  63. 6 v" k9 m7 Z% _& T) B" C- ?) M1 C
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
      x# r' E- ~( p, Y" P2 _2 X
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);+ {+ k" P6 h4 |# x3 k
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);; H# V& }7 h; e. s0 b4 L# H

  67. " S/ R7 E3 H8 v2 ?1 s; W
  68. dma_addr_t dmaphyssrc1 = 0;
    ! G8 K- e" A- z" s1 U( |7 K. i
  69. dma_addr_t dmaphyssrc2 = 0;
    ! K7 a4 j2 e5 O5 M$ y
  70. dma_addr_t dmaphysdest1 = 0;* e4 t  H6 w. O" P1 X& u0 Y
  71. dma_addr_t dmaphysdest2 = 0;
    . ?' b+ x2 q' v( u6 y! a9 t
  72. - k. n" U) [1 P* L
  73. char *dmabufsrc1 = NULL;' W5 P/ {/ F6 A9 V
  74. char *dmabufsrc2 = NULL;
    ) j$ D1 C6 {! b3 H# A. t4 J7 m
  75. char *dmabufdest1 = NULL;- b& A( J( O  m. I  c# m$ `/ v
  76. char *dmabufdest2 = NULL;. y# S" i* f8 S' a4 c# @) d9 V

  77. 3 R! t$ L  H' t7 Z9 o: @* D
  78. static int acnt = 512;
    + u% ~3 R. B' H9 K* S
  79. static int bcnt = 8;- @' Q4 C) `! u/ K
  80. static int ccnt = 8;( \8 q! J. ^4 n5 b7 @$ X& w# P
  81. " {% y) W4 x2 r* n4 p- E9 b# {1 f
  82. module_param(acnt, int, S_IRUGO);* o8 G% g: z" V2 c) T  o& h$ f
  83. module_param(bcnt, int, S_IRUGO);
    . F& b# Z% C/ Y- G( B- q8 U0 W
  84. module_param(ccnt, int, S_IRUGO);
复制代码
) h' e8 v/ s+ E" f% c! @0 o

" K0 Q! f/ r) v      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
. d  L. P/ P6 L& @" Parm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
  m: w) d2 z0 q2 L: y! }, _3 p2 K2 i3 ]     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
  Q0 M" L8 k! I& b0 e; d& h% o; N) \. J, J1 J/ Y7 n+ |0 a$ B

& W+ X- S& l7 k
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-3-17 09:18 , Processed in 0.044727 second(s), 28 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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