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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 / [' g% W; h) f% m
  1. [code]EDMA sample test application- o$ j0 u4 c0 h0 r& Q+ B- e
  2. /*
    ( M* S4 J) Y2 U" L5 {
  3. * edma_test.c
    : d8 @5 l; V$ c
  4. *
    : x) t2 M# t2 _& z: G; Z
  5. * brief  EDMA3 Test Application6 Z6 o) \6 O: Q8 Y
  6. *) \  k1 x' E. @9 r. o5 |: m* N
  7. *   This file contains EDMA3 Test code.& P* Z% w& i5 q& p. H
  8. *
    7 ^5 r* S. u( W3 r6 p
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE' p4 R2 c2 ?8 L
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT8 a; U! n- z8 N/ W( ]% L) q
  11. *         TO CHANGE.
    * R* ?8 s  a: z7 m5 n! B
  12. *
    0 v0 s( M) T! @$ e# z, b
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    ) Z8 F+ b& N/ V* z
  14. *' `+ I2 P. V, i* p7 k  S
  15. * This program is free software; you can redistribute it and/or6 [, y" M+ H4 o7 M" A) ?- f
  16. * modify it under the terms of the GNU General Public License as
    ! h  o+ b+ ?% s& K" s
  17. * published by the Free Software Foundation version 2.! m, M! l% O; B& V
  18. *
    4 D. V) J3 B3 {1 k, D3 z- H
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any: t  k2 L8 _3 B# a: C- `
  20. * kind, whether express or implied; without even the implied warranty
    ' _. c% O& A! ]) w, l
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the6 e6 ^- i: P5 O
  22. * GNU General Public License for more details.
    5 ^3 J1 g  z) _  J2 @5 g7 U
  23. */
    1 r9 m6 J6 M% K; u1 {

  24. / N$ h: L- w3 Y" u/ z  S# S
  25. #include <linux/module.h>$ q: i% b$ Q# N7 f, u. ]
  26. #include <linux/init.h>* Z1 |/ W0 F% {. ?
  27. #include <linux/errno.h>
    : m  x* P: U. p
  28. #include <linux/types.h>7 B  J- p0 r$ `+ i/ k
  29. #include <linux/interrupt.h>
    1 T- ]  h2 t, k5 G& J  O8 y% J# `' z
  30. #include <asm/io.h>2 J  _; z) g+ T* w. `
  31. #include <linux/moduleparam.h>
      d# W4 T1 a. @  W! s: I$ z, I- ]- ~
  32. #include <linux/sysctl.h>9 G- S3 V0 P$ {+ V
  33. #include <linux/mm.h>
    * @- x6 j$ \! x4 \3 C2 D8 O- v" k
  34. #include <linux/dma-mapping.h>, s: J3 c3 b: w7 R7 i: y8 |7 F

  35.   v6 [  x6 n# A$ c: q, [8 o
  36. #include <mach/memory.h>
    5 ~3 t* r. Y" d- u5 U* x/ C# e
  37. #include <mach/hardware.h>7 G2 h: _: `* ?' c- ~5 n
  38. #include <mach/irqs.h>  n" L2 R: c, T  q/ G
  39. #include <asm/hardware/edma.h>
    . N+ e; M2 S8 A

  40. 8 v2 J; D5 Q2 J7 @: S
  41. #undef EDMA3_DEBUG
    ! T3 y2 f+ g' j2 e6 d, J
  42. /*#define EDMA3_DEBUG*/3 J. r: C4 Y3 O1 q

  43. ) A6 |: R' W- f7 Y+ H
  44. #ifdef EDMA3_DEBUG& O, @* {6 p5 N. V. u% D
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    9 A2 I0 J% w4 ^$ M! h% X
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)0 n# v6 k+ K$ b- I  A( q
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    ! j1 O: Y8 q0 N$ {( ?( a6 A
  48. #else+ ~6 @  o5 K; [  ^& C
  49. #define DMA_PRINTK( x... )8 j( X" N, {0 P+ S/ l( I
  50. #define DMA_FN_IN4 r9 u& T( \- b  U% i
  51. #define DMA_FN_OUT7 n0 P# W3 f( S& J* y
  52. #endif
    $ n: ~5 m. O$ X6 y& ?, v9 S
  53. - e* n- J' m( e% V; R) C( x4 x
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    # d; d! E/ f# P" v/ N* s
  55. #define STATIC_SHIFT                3
    9 f5 ^& e) d: _* [
  56. #define TCINTEN_SHIFT               20
    9 g$ e4 r. N( c
  57. #define ITCINTEN_SHIFT              21$ A: w; `; w& {. E& j+ s
  58. #define TCCHEN_SHIFT                22
    $ t. c) S" b' I; H7 Y& N
  59. #define ITCCHEN_SHIFT               23
    $ a& R! L+ ?- `# e5 r9 V
  60. 2 J) M, ^& E. d* A0 M& y- D
  61. static volatile int irqraised1 = 0;
    & c: _7 L) k) w% m8 d" y. a4 `# I
  62. static volatile int irqraised2 = 0;
    8 m1 b6 A2 `+ e. R
  63. : s6 h+ }8 }/ j5 L& ?. f2 F
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);0 h! M- E( w/ s3 _: ~- g' S4 _
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);# c8 E* C8 [/ z! X5 x- s- q' Z5 ?0 m
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);1 [& W9 Q6 e* U. D9 e

  67. 9 D" x/ `- v& Y& t0 ?& b
  68. dma_addr_t dmaphyssrc1 = 0;+ B2 w* L0 d) _" U. a) S
  69. dma_addr_t dmaphyssrc2 = 0;
    5 ], @1 G3 @: J$ r! H
  70. dma_addr_t dmaphysdest1 = 0;
    & U* G+ k$ W" b
  71. dma_addr_t dmaphysdest2 = 0;) C: P5 O$ c6 R
  72. + T" W) n: S. _9 ^' T! I
  73. char *dmabufsrc1 = NULL;; g; x2 r  b- J# m: O& V% F
  74. char *dmabufsrc2 = NULL;4 o0 w8 m+ H( y: u% R/ g
  75. char *dmabufdest1 = NULL;
    ' ~" I+ O+ T2 _& S# l% u+ e
  76. char *dmabufdest2 = NULL;" n% ?2 S. P: B6 a% g

  77. 7 x- p( r9 {) m4 M
  78. static int acnt = 512;
    / k' z: f$ H8 k, E3 \
  79. static int bcnt = 8;2 o! W" M2 k8 n( @4 D
  80. static int ccnt = 8;
    ! d# B, u$ w0 H2 z# g5 v

  81. $ }2 G) I% `2 Q  i( B
  82. module_param(acnt, int, S_IRUGO);
    ) z' \! }6 K/ |, }" h9 l% c7 x2 M
  83. module_param(bcnt, int, S_IRUGO);2 t7 Q  j+ i* ]5 B  p4 X9 g
  84. module_param(ccnt, int, S_IRUGO);
复制代码
  j3 `& n! z" n1 c
' I( N; M& N! `' t6 B5 b' a
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用- n6 E% |; M# X4 @1 ?/ P
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。, b4 q% B: |5 h& p
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。/ x  P. i8 d1 S$ p' @
6 g. a$ n& o1 F3 A, }) z% a

* D% D" T2 \# e, u
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-10-9 05:11 , Processed in 0.038891 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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