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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
/ s- ~$ y8 A4 l5 s6 X
  1. [code]EDMA sample test application6 U5 N7 n; D6 X
  2. /*; _! A4 {- [1 A8 P! [; B
  3. * edma_test.c
    ( z, ?9 j* @3 c! D; {2 p
  4. *
    ( Y: ?8 w8 C2 L9 m, Z. ]
  5. * brief  EDMA3 Test Application
    " h4 S' i# [" h% b# i6 Z# M2 {  M
  6. *
    ) R$ Z& Q* s) F* T
  7. *   This file contains EDMA3 Test code., k! b8 C' t2 }3 o* ]# W
  8. *) y' ?4 a0 h% z, N! i5 S
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE$ _; F8 l, y: U/ ]9 V$ ^; I
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT" [' L0 v* p1 c5 X: P
  11. *         TO CHANGE.2 {+ y3 ]1 x3 u/ J& l7 R+ L
  12. *
    ; C6 D8 p% G( Q: j6 A( ?( }, K6 V) P6 i; n
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    , G) m5 Y3 o0 k
  14. *
    1 R. C  f! \& S
  15. * This program is free software; you can redistribute it and/or
    $ p7 _8 }$ [# O6 D$ w
  16. * modify it under the terms of the GNU General Public License as
    # \3 i! T( e; X: G# l& m; ^! Q+ E
  17. * published by the Free Software Foundation version 2.
    + c0 |2 u: g1 h, _$ O1 x
  18. *9 q2 x/ }. Q" O, L
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    " p' T/ G/ W& ?8 j+ [  v
  20. * kind, whether express or implied; without even the implied warranty; g% ]+ I& y% k* E
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    " B) S4 e$ E& \- K
  22. * GNU General Public License for more details.
    - x! Z8 K: |4 Q3 K9 _& M) T4 ?
  23. */0 c# k5 H. w, R! a. ?# _
  24. 1 I8 B2 @6 ]. P: p5 r
  25. #include <linux/module.h>/ C6 U- _/ L9 z9 R2 B3 L" j
  26. #include <linux/init.h>0 j7 G& W7 g; s- r1 K
  27. #include <linux/errno.h>
    ) E0 t4 B- `5 ?! \" l6 I7 ~
  28. #include <linux/types.h>
    7 r3 m! ^8 H4 q; `
  29. #include <linux/interrupt.h>. W" M7 M) A3 ]" P
  30. #include <asm/io.h>2 }" u7 S! A" f  T
  31. #include <linux/moduleparam.h>
    " g3 H  k$ x8 ]" L# c
  32. #include <linux/sysctl.h>/ m6 M3 @7 q6 ^0 G
  33. #include <linux/mm.h>
    - [9 `) I) m! }2 {5 f
  34. #include <linux/dma-mapping.h>2 Q# G. C0 o3 f( ^% g
  35. 3 y! U( c0 o) h6 l
  36. #include <mach/memory.h>0 x, y; P. |, a$ `$ I
  37. #include <mach/hardware.h>
    ' x8 W2 H5 n( Z
  38. #include <mach/irqs.h>
    3 T& c- V+ i9 h% D6 o- p
  39. #include <asm/hardware/edma.h>7 }- l! q+ z  S& j  a& O, U
  40. 5 v- n5 _8 H' w7 F3 Q
  41. #undef EDMA3_DEBUG$ r" }# N% S4 `( k# }8 C& Q
  42. /*#define EDMA3_DEBUG*/# Z/ L. C; j+ \2 \: P' Q
  43. ( e; F: P8 F8 b, f+ |6 t) f( B3 l8 e
  44. #ifdef EDMA3_DEBUG: d: d: t; y7 ~
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    " V0 e2 P8 b! v4 _8 ^" w/ p
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    % b: J+ V: b4 W6 W  A9 T* O
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    4 m- H* G& w* I7 n" n
  48. #else: ]+ C  V/ }3 I! G2 Y
  49. #define DMA_PRINTK( x... )
    8 d5 \' K2 W( T6 ?. c* S
  50. #define DMA_FN_IN
    ' _. b9 N9 s9 r* z. j. }
  51. #define DMA_FN_OUT% o" X* D: t& v
  52. #endif: U+ h# I( N. P% ~5 v5 t

  53. + U5 j7 q6 D! b2 w
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768): G& t1 F3 S0 A/ z' [
  55. #define STATIC_SHIFT                3
    : l' \( u' I" A3 ]0 x
  56. #define TCINTEN_SHIFT               20
    + ?' I9 }  |, V( q5 {" \+ }( j
  57. #define ITCINTEN_SHIFT              21
    8 A; f$ \/ A4 Z
  58. #define TCCHEN_SHIFT                227 ]4 k  R/ u4 H$ p3 o
  59. #define ITCCHEN_SHIFT               23
    + V% r& |8 m: A! L& v
  60. * S* S* r$ J3 p# a. z" J* E
  61. static volatile int irqraised1 = 0;' r) H/ h$ F! \- f" H; ?) |9 j( F. f3 A
  62. static volatile int irqraised2 = 0;
    , E( \2 }( C" c7 _

  63. ( u: e7 X( g+ @
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    # W3 V  ]& i5 Y
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    * y6 ]; K* J/ ]* Y* J) L0 E
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    * _# n5 G0 ~  Z% S
  67. 3 J$ ?4 N+ d% }. U. s  G' g: x
  68. dma_addr_t dmaphyssrc1 = 0;
    3 |; }5 d/ M, D3 B) C
  69. dma_addr_t dmaphyssrc2 = 0;7 l1 E$ a% t4 K' M
  70. dma_addr_t dmaphysdest1 = 0;5 Q& n& I+ s% N0 l
  71. dma_addr_t dmaphysdest2 = 0;
    ' E6 a6 n* }8 B0 S& ^2 r
  72. - ^" O2 M: g: Q; f. {3 t1 w6 I
  73. char *dmabufsrc1 = NULL;9 f0 J& l9 C+ [# R' Q
  74. char *dmabufsrc2 = NULL;; ~- z3 P/ m. Q# h* s0 O* t
  75. char *dmabufdest1 = NULL;* g2 X, e# u" o; N
  76. char *dmabufdest2 = NULL;
    , j+ E, J8 j; Q* ~' J
  77. # G' b6 p7 R2 I0 L8 G, u4 }
  78. static int acnt = 512;
    5 V9 ?. j3 i! m
  79. static int bcnt = 8;
    + v& _" |4 q9 P' F9 i
  80. static int ccnt = 8;# p  k# l0 {( g% D- n

  81. 1 h9 U- L  t* B8 L4 L
  82. module_param(acnt, int, S_IRUGO);8 A9 B& b/ F" B7 m& R9 d* v8 X
  83. module_param(bcnt, int, S_IRUGO);& y( y1 `4 g/ P  x$ {# |
  84. module_param(ccnt, int, S_IRUGO);
复制代码
& B% H. b, Z0 y
5 w  b' A- H9 d3 ~5 i
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用/ e  {4 K4 X+ @
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。* t0 l( m$ k8 q  i. T$ {
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
- o. C" {( K5 l9 ~, _2 @
/ T% u* i3 l* ~" k) b
2 B! q( j3 H+ g( }. P; t
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-2-15 02:23 , Processed in 0.041876 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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