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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 6 |! \8 Z. |5 b7 n; K* _
  1. [code]EDMA sample test application- j. I' G) Z9 I. f
  2. /*& t+ s% k% r2 B
  3. * edma_test.c
    ! z& E, M; P7 X5 t0 z
  4. *
    8 V' u2 T( q. j
  5. * brief  EDMA3 Test Application- K/ p0 \. V7 q. y! L  u% d
  6. *" r0 c1 i/ u, _0 L
  7. *   This file contains EDMA3 Test code.
    / O3 M% C$ s. i2 L3 J* E8 s6 p
  8. *
    5 r2 P+ y% ~; J* t6 U
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    / g1 E# J. O% \7 L- e6 X
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT; a" \9 {7 z# \+ K/ p
  11. *         TO CHANGE.
    5 K& s' u' G  u. \, X+ C: C  l
  12. *
    : i1 O  B4 N; `2 g* {
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/% X( p; {# }! v+ a
  14. *
    7 }; F0 E3 N* G4 [. N0 C% c
  15. * This program is free software; you can redistribute it and/or
    8 N' O9 c& X% _+ _+ C, a% Q
  16. * modify it under the terms of the GNU General Public License as2 Z9 d5 w+ n! {; f6 Z( [
  17. * published by the Free Software Foundation version 2.
    8 w9 m' z" Y  W+ S) k4 p0 Q1 g
  18. *
    7 i1 H# e7 p; u# R- o% O
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any* f' r  S7 L6 X- n
  20. * kind, whether express or implied; without even the implied warranty
    & K+ f, y9 W: R& f7 d! n
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    8 I' x; S4 Y' a# d. e
  22. * GNU General Public License for more details.
    7 S  E; D, J1 s" W' ^: g. M( d4 B& e
  23. */. E% ~  g' G7 I6 o/ q5 [/ q

  24. % }' u6 Z4 t3 {& z3 w- N+ R& v' z
  25. #include <linux/module.h>$ Q+ c& I0 Q: p/ b8 R8 s
  26. #include <linux/init.h>
    ( u3 w+ q1 H4 U- x- e
  27. #include <linux/errno.h>$ \# ^" ?/ V! M6 n, x, _
  28. #include <linux/types.h>* s' }3 O2 t( V& M0 X3 @
  29. #include <linux/interrupt.h>- J1 }3 r& ?- L, w& M; T9 H5 |
  30. #include <asm/io.h>1 ?- T2 ^, N9 l# @4 P+ V0 L% V
  31. #include <linux/moduleparam.h>3 Y( U9 Y3 @5 h
  32. #include <linux/sysctl.h>) J/ e1 h4 _  }. S% t7 m" B
  33. #include <linux/mm.h>
    : K6 {) H* A( M4 J+ P1 }0 w
  34. #include <linux/dma-mapping.h>9 Y2 x/ L# I/ r1 S8 a1 S" {
  35. ) ]& X1 B9 J7 X7 a4 W- P
  36. #include <mach/memory.h>
    6 [5 |5 E1 P9 o" ]
  37. #include <mach/hardware.h>' S' N8 S# K- [/ e- r0 e
  38. #include <mach/irqs.h>
    # B) s0 ?- a- g5 T
  39. #include <asm/hardware/edma.h>4 b( n8 x4 ?, F- [1 m/ ^9 j
  40. 0 J" {7 W  B9 d8 K) S, B3 O
  41. #undef EDMA3_DEBUG
    3 @! R! b. Y1 d& {, x. f% q
  42. /*#define EDMA3_DEBUG*/9 \/ @  ~, P+ w3 Q/ D; N' m- K
  43. 1 r* \1 K- p, L4 {. B7 T
  44. #ifdef EDMA3_DEBUG
    7 c" h" Z- v# q0 x9 p% s
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    . e' f# w4 N- R3 x, N9 j
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    0 U) l! H$ u) `, M4 D
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    ( J5 J4 Q$ e( y; O/ W7 R4 x& I
  48. #else
    ' R* F0 ?4 x4 A4 {3 J2 B
  49. #define DMA_PRINTK( x... )
    ' V0 ~% u; g" _
  50. #define DMA_FN_IN7 t8 ^5 x6 |6 T. ~8 B9 K$ s
  51. #define DMA_FN_OUT( r1 Y1 L9 i* k( X/ m
  52. #endif
    / V6 v7 p; Z: q, I! ~$ i' v7 D0 }
  53. $ t8 F/ w  B" U( J
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)6 ^( C6 ]7 j3 z$ F. d/ d# h
  55. #define STATIC_SHIFT                3
    4 Q9 w& o* g0 d, @$ R
  56. #define TCINTEN_SHIFT               20
    / ?1 N- y0 v, M9 T; w
  57. #define ITCINTEN_SHIFT              21- c. E- c1 i9 Q0 Z7 _5 D8 L
  58. #define TCCHEN_SHIFT                227 G: B0 Y0 O' {# _! \1 W  z0 w
  59. #define ITCCHEN_SHIFT               23
    / N+ Q! k3 A7 y0 ?5 b! [
  60. + x  ], E0 ~9 R  l% l
  61. static volatile int irqraised1 = 0;* K2 X+ G, }( R- g/ v; T, w
  62. static volatile int irqraised2 = 0;
    7 H$ _( B- N2 D
  63. 9 K; l, t2 T0 V4 a
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);6 q8 i# N  I* _3 a+ |
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);; i$ o$ E- {$ }! r
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);3 j: O8 v: W) o' I

  67. 7 J& ~% E0 d5 H; p% v6 r2 a' t
  68. dma_addr_t dmaphyssrc1 = 0;
    ' y- D3 b4 @3 \3 d6 R
  69. dma_addr_t dmaphyssrc2 = 0;  T7 s# |: X8 I- b
  70. dma_addr_t dmaphysdest1 = 0;
    $ c3 E, `: ^; V
  71. dma_addr_t dmaphysdest2 = 0;
    " w& B. P* T  U! y" q
  72. 3 a) \+ s9 m7 s% R) x
  73. char *dmabufsrc1 = NULL;
    2 b5 @( R1 K3 E0 {, U
  74. char *dmabufsrc2 = NULL;# T" |% C3 Q9 {! E
  75. char *dmabufdest1 = NULL;
    6 I6 I9 l: U+ g/ j: w" f+ l3 ?
  76. char *dmabufdest2 = NULL;; |! J9 {8 H. o1 c$ V. ~' t* d+ m9 b
  77. . E8 K, r7 n4 |9 v
  78. static int acnt = 512;3 f- S+ d* Y5 U6 L: L( ?3 x8 ~" B
  79. static int bcnt = 8;
    6 u+ q3 k$ E$ u; d% d6 \, m6 }
  80. static int ccnt = 8;
    ( G! S8 z1 K2 r1 P/ f

  81. , G' N; B8 l! u
  82. module_param(acnt, int, S_IRUGO);3 n2 I$ X$ \2 ?% ~
  83. module_param(bcnt, int, S_IRUGO);) _7 v9 S4 S' g+ g* x
  84. module_param(ccnt, int, S_IRUGO);
复制代码

. n0 t8 A9 f9 L$ b" J$ e3 c4 X2 c% c9 ?% t% o
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
* ?0 c7 w# v+ q3 O% H* {4 ^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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
' b$ O* ?, t! h. L8 L- G" B! P     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
5 B: X5 [6 G; ~7 }* f) b
9 Q8 y+ p% J! c! @  y" x- X- |( G  ~, _5 i$ K% `* p% o" q
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-3-26 10:00 , Processed in 0.039732 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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