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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 + M) L6 q; L( Z: Y9 E. _4 a2 i
  1. [code]EDMA sample test application
    + |2 c- I7 ]# a& L1 }
  2. /*2 R0 y0 P. |. p! |$ k
  3. * edma_test.c7 p7 m) L6 S- Q2 K
  4. *
    5 ~1 X4 ^+ ~. Z0 c
  5. * brief  EDMA3 Test Application0 A- T- E" W6 N5 u: ?  V& `
  6. *( E- g6 O7 \" _+ s
  7. *   This file contains EDMA3 Test code.
    4 u# n. y; C9 [' C
  8. *9 I% y: x6 c; L5 G; K4 M+ ]
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    + U0 w- ]$ a8 s! e2 @8 j2 l
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT  L5 o* F. g9 H8 m1 g
  11. *         TO CHANGE.; Z, `& u" {9 \# b* r8 R( c
  12. *
    6 _( o1 f; F- U8 T6 p7 I% n
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/9 a- ]+ U1 Z+ n$ Z
  14. *
    & X, {: |3 y/ Q. m
  15. * This program is free software; you can redistribute it and/or
    , m/ ~3 R: t. u: w
  16. * modify it under the terms of the GNU General Public License as6 W' w( C) w* n: L5 `
  17. * published by the Free Software Foundation version 2.0 ^/ M4 S! C# S8 m" }: t) i" z
  18. *
    ! Z- |/ p) {* n* r: E
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    . J) U2 p8 I$ N
  20. * kind, whether express or implied; without even the implied warranty
    7 s( D( D- p' ?& _' b4 ^
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    , `7 m7 \9 s$ `8 V, Q0 ?1 X5 I
  22. * GNU General Public License for more details.. R7 g1 o5 O, Q! O
  23. */
    , E0 F' d) m! }+ L  P6 I  \
  24. 7 p! p0 a( p$ _0 m
  25. #include <linux/module.h>$ \/ a  O+ I# \  Q
  26. #include <linux/init.h>% o0 ^1 n/ g8 [8 x/ _
  27. #include <linux/errno.h>! K2 R$ h7 `: b* c4 K9 ]
  28. #include <linux/types.h>+ _+ I5 B5 J% c; Z& `. A# D; Y# J+ ~
  29. #include <linux/interrupt.h>9 D2 j7 u: j0 U& [0 J3 ~6 w
  30. #include <asm/io.h>+ C; i: L  K. i  t
  31. #include <linux/moduleparam.h>, {: t; K' E0 Q6 d+ q6 }6 H9 l
  32. #include <linux/sysctl.h>
    2 I* a8 \5 L+ B' P) G' S
  33. #include <linux/mm.h>
    ; m- i! n+ j9 p& x! j# x  E
  34. #include <linux/dma-mapping.h>
    7 V2 y. d' {6 H5 S$ q
  35. 7 z  l& o6 i1 T, S
  36. #include <mach/memory.h>$ g( N8 h, p, `
  37. #include <mach/hardware.h>3 m# E' @  }- N) f6 G
  38. #include <mach/irqs.h>: X4 e- D: R/ l9 U) _
  39. #include <asm/hardware/edma.h>! m4 l  L, E% @' B+ s

  40. 5 P2 Z- ~- i/ T! V
  41. #undef EDMA3_DEBUG6 b3 c; h# U0 d
  42. /*#define EDMA3_DEBUG*/
    1 e% K8 P; O* Q/ _
  43. * `# l3 i1 L& J5 Y
  44. #ifdef EDMA3_DEBUG
    ! `; {" a# V1 s  {
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    5 G3 s2 P2 e- |6 ]
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)$ X1 V* @8 f7 b+ z# l6 V
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    ' O# G! J+ b& W* ]3 F$ o) Q3 k
  48. #else6 h& ?& P6 u* l
  49. #define DMA_PRINTK( x... )
    & A, y! i; B0 I: o
  50. #define DMA_FN_IN! c% b3 _  k: S) r7 O: M0 t* P
  51. #define DMA_FN_OUT
    , {+ O; X" x4 `. T: l7 I& S
  52. #endif
    # s0 w9 b2 S! A% p! R, |) P
  53. 7 [7 _- g' ^7 ^. k
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    ; H' \) B) \8 N8 d* h5 v& W
  55. #define STATIC_SHIFT                3( D* F5 \. K, v# ?0 F2 Z  O% H) u0 ~% D
  56. #define TCINTEN_SHIFT               20$ n' q# s7 f- S& s
  57. #define ITCINTEN_SHIFT              21
    # ~. j; @  N4 \" e' P& U
  58. #define TCCHEN_SHIFT                22) y8 J8 r. x. ?% e- Z
  59. #define ITCCHEN_SHIFT               23
    7 n! U( S/ q* B' I

  60. % x7 p" l  }5 I. F3 p8 q
  61. static volatile int irqraised1 = 0;0 y3 W# u9 p, x2 G
  62. static volatile int irqraised2 = 0;
      M( z" q8 q  \% a3 ?
  63. 8 N! B: W0 c6 `" z6 u
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);( X- D7 a4 p& _0 G3 I0 U5 y& F7 \
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);3 c. h0 Y# a% m* ?8 N
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    1 c/ L! b; _* f3 h7 b2 ]; @# j
  67. 4 {$ n( ]  z: k3 _$ I' }. b
  68. dma_addr_t dmaphyssrc1 = 0;, T" h- Q+ l- Y) F% ^& C, e" {
  69. dma_addr_t dmaphyssrc2 = 0;
    ; S' n* @% f: t, I
  70. dma_addr_t dmaphysdest1 = 0;+ ^& w& D  C  |) K$ ^) E/ E( P
  71. dma_addr_t dmaphysdest2 = 0;' d( U6 D+ \9 @5 a: a
  72. . }! Y5 N3 f0 x. H
  73. char *dmabufsrc1 = NULL;
    : c$ w3 B) ?; s0 G( _5 u
  74. char *dmabufsrc2 = NULL;* Y2 o8 o6 q0 }+ p( e
  75. char *dmabufdest1 = NULL;
    5 {7 V8 w& s3 g- ?
  76. char *dmabufdest2 = NULL;
    . Q0 H. U, W3 D0 d4 Q2 J

  77. 7 O" v: ^* w/ o- }9 O- n
  78. static int acnt = 512;* S/ p$ Y( }5 o4 ]
  79. static int bcnt = 8;$ S, `5 [* a) u# a4 \
  80. static int ccnt = 8;
    ; B" p- L% l8 W5 X" C7 K
  81. * o* `8 Z' K3 z* S- C
  82. module_param(acnt, int, S_IRUGO);
    1 H$ z/ f7 O: Q3 @  q) l
  83. module_param(bcnt, int, S_IRUGO);& w  G0 M+ F1 |+ f2 S, f; J
  84. module_param(ccnt, int, S_IRUGO);
复制代码
3 n& j- w$ L+ d

7 z9 y! f# M1 N& o# D4 r$ B% g      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用! U# C" l1 Q6 Q; l. f4 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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
7 y$ d( C2 d2 r: Y% |     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
1 h& b- g$ `4 p
3 _/ q4 z0 h6 U3 K4 n3 U
1 z$ p0 {: F: G( V4 i
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-2-15 18:12 , Processed in 0.040436 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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