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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
( _* }: I" e2 n5 ~. U5 @, \  U# Y
  1. [code]EDMA sample test application
    ( ?% a+ t$ W% t& u
  2. /*
    0 h& F6 d; `" e, U. p7 @
  3. * edma_test.c) m+ G8 P# ~2 K
  4. *$ ~4 t8 s$ ]  t! F
  5. * brief  EDMA3 Test Application4 ~0 D: E3 x0 P+ p' h1 Z
  6. *5 K1 o1 `! X) |5 k
  7. *   This file contains EDMA3 Test code.
    $ r7 F/ W' j  o. r. S1 ]* p/ S# g
  8. *
    & p+ j1 l( T3 {6 T
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    & o$ D  F8 q3 N" z
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT; V& B5 G/ R7 S/ |' E& h: w, I
  11. *         TO CHANGE.4 @( ?  m6 V( u1 v
  12. *- y& W( F0 ]1 u2 s( Y: v
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    1 B1 N; {5 k* a
  14. *# @8 y% ]+ w& h' J0 Q2 a1 |
  15. * This program is free software; you can redistribute it and/or; U8 S! z1 ?) ?% [' X' m
  16. * modify it under the terms of the GNU General Public License as
    - v+ Z7 A- i1 M9 C( e
  17. * published by the Free Software Foundation version 2.
    3 q& |5 V3 Q; A/ x6 Q2 p* J7 [  H4 J
  18. *: |& s/ j' q! T8 ^
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    + r7 _. t5 c- h  T1 J* r- Q
  20. * kind, whether express or implied; without even the implied warranty9 A7 Q- D8 ]! a" E
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the; ~7 D/ n( A% c' r* W* k0 [4 p
  22. * GNU General Public License for more details.  h" O( c) h$ N) i% S$ u
  23. */
    2 s& p% f& s! K2 ^* C! s
  24. ' X6 j" i+ B0 U. f2 O$ j
  25. #include <linux/module.h>
    " I, E- P( d. X% g0 S' w4 C0 A5 i* C
  26. #include <linux/init.h>- h0 i. F8 C3 Z
  27. #include <linux/errno.h>
    0 Z5 V1 V9 u7 a$ }7 V- p
  28. #include <linux/types.h>" e: n7 Q8 w9 l7 |. X; C" |
  29. #include <linux/interrupt.h>8 e  O5 q& t8 V4 R
  30. #include <asm/io.h>+ f: h5 s! N7 ]3 ^
  31. #include <linux/moduleparam.h>9 |6 a8 \' w- f) {  N
  32. #include <linux/sysctl.h>
    . _) c6 p: u9 ^# {7 J5 `
  33. #include <linux/mm.h>
    $ A% L  g1 `! J* b6 I
  34. #include <linux/dma-mapping.h>2 A, l* R7 {7 d0 a, E; S
  35. 9 c  n/ m8 v, ~! K- M: Z
  36. #include <mach/memory.h>2 a+ Z6 F8 S  ~# f
  37. #include <mach/hardware.h>5 U6 Z1 a! u% O+ E4 X$ {1 h( b
  38. #include <mach/irqs.h>5 K0 n5 `) b7 t4 @1 {% L( o; l2 V
  39. #include <asm/hardware/edma.h>
    0 l& Z! E% I1 U0 {" ]$ O

  40. ; A5 f* ]$ a: u
  41. #undef EDMA3_DEBUG  b) W4 J( w8 ]1 s9 {' x6 X  A# n
  42. /*#define EDMA3_DEBUG*/
    - v9 W! J. L+ y! [
  43. 7 z1 R+ a/ }6 m; G' x( }, _( p
  44. #ifdef EDMA3_DEBUG. w5 A& M5 K# L% w3 [1 g' B6 i
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)- C. z2 @0 |! A. J
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    " U; r9 E" w$ ]5 G( W
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)& z# A3 A' _% ~* p4 @4 o
  48. #else% f- y6 |  P8 s/ V
  49. #define DMA_PRINTK( x... )
    + _$ y+ ]8 [! c2 S4 g# W& ]4 g
  50. #define DMA_FN_IN  t6 h. s: [; {1 }/ r$ ^+ ~
  51. #define DMA_FN_OUT$ D# t0 ~2 ^5 q( s& h( k
  52. #endif/ e! r! T" M# w3 \/ l; B+ Y
  53. & x" f3 R% F5 I2 e0 `; u) W/ G
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)& v6 h! Q  M* p4 O7 @: |  v
  55. #define STATIC_SHIFT                3
    % o! D  M- W1 ]5 w+ e* E; ]
  56. #define TCINTEN_SHIFT               20# v) V0 N4 a4 K1 ]
  57. #define ITCINTEN_SHIFT              21' h' N% Q1 A+ _0 L7 g( \) s4 c
  58. #define TCCHEN_SHIFT                224 N5 U7 K# c) V1 S* w) G; t
  59. #define ITCCHEN_SHIFT               23
    . G6 {7 `, \. Z3 J9 E' h, {4 S& \; h
  60. ) O3 H0 x' K+ ?  E
  61. static volatile int irqraised1 = 0;( P7 s* }# I% A
  62. static volatile int irqraised2 = 0;8 k# n' T% W% k9 E

  63. 3 G( }0 V9 q# Q' \- \; J
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);: `+ K4 O* v3 {. Y* Z
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    $ T/ N9 ?$ w3 }' I4 K) I; [
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);  }3 v- C0 M) x4 W; y3 H
  67. 2 q/ m+ o: e1 L4 N% g
  68. dma_addr_t dmaphyssrc1 = 0;- Q) I- L- }8 Q
  69. dma_addr_t dmaphyssrc2 = 0;
    / U4 d3 W# Y$ i. Q2 X# l
  70. dma_addr_t dmaphysdest1 = 0;
    ( y3 d: ^, @* |" `2 h- ?% i
  71. dma_addr_t dmaphysdest2 = 0;
    ) e) v, ~/ A) K7 v2 [

  72. / }( ^' s2 u9 o
  73. char *dmabufsrc1 = NULL;
    . l0 z+ t4 m, V) J$ A
  74. char *dmabufsrc2 = NULL;
    . p& n; s3 ~" |* p9 y+ l/ s! L
  75. char *dmabufdest1 = NULL;4 l9 ]: F2 I8 u
  76. char *dmabufdest2 = NULL;
      T7 ?( j, _) u' ]. i" }0 V: o# W

  77. $ E7 R  i" Z' a/ @9 T7 d
  78. static int acnt = 512;
    % B- H# W% X( g! p% \# j8 F  ~
  79. static int bcnt = 8;, S% E* U* y1 Y# x7 K
  80. static int ccnt = 8;
    # U# `1 f3 b. G* W& c1 z

  81. : f; W/ ^4 q- v- j; o! Z
  82. module_param(acnt, int, S_IRUGO);
    9 ]$ |( q  T# S9 g8 b: G
  83. module_param(bcnt, int, S_IRUGO);
    / C7 w; h; G% U0 H* V7 f4 v# J
  84. module_param(ccnt, int, S_IRUGO);
复制代码
$ D. ~9 T: x* b4 e
. m6 ~4 [2 Y  |, ?1 [
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用% X) b( o' m) n0 |
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。( _" x* e0 ]. F5 H: e" k6 `
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。0 Q  P' }' y- }! @7 n

: g( O9 P1 \- @  ?0 @1 C9 N
5 w! ]* V) |4 _$ l5 u
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-2-10 15:14 , Processed in 0.038218 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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