OMAPL138如何在Linux下使用EDMA3驱动 - OMAP-L138 - 嵌入式开发者社区 - 51ele.net
设为首页收藏本站

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
0 |" i9 u+ ~  X7 V
  1. [code]EDMA sample test application
    8 l" H" `% [' Y6 l% X1 A/ V) E
  2. /*
    $ e% C7 u) O  i
  3. * edma_test.c
    * B- I  ~5 }, s; b& n5 x' m0 Y" y
  4. *
    - r# Y) W5 _. Y0 N' g
  5. * brief  EDMA3 Test Application
    8 ~( V& M5 b" H4 ]3 C( Z# Z
  6. *
    * [0 f) \# S+ m. B$ ?
  7. *   This file contains EDMA3 Test code.
    3 N) K7 G, g; H# P) z
  8. *
    ; ?9 G1 S7 d. N7 N- ?; n" P8 a- e
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    3 e$ c4 V, y. q8 \
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT- i0 K. L# t& K7 L
  11. *         TO CHANGE.* K) v4 _! b# c8 L9 b: @: A9 a
  12. *
    , P' a3 ~/ `# N+ \
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/7 S5 v( b9 O) l
  14. *
    3 d. N( M& b5 L+ h$ u$ a: C- `5 ]8 i
  15. * This program is free software; you can redistribute it and/or
    1 W7 k  F" A" u4 U6 n* a
  16. * modify it under the terms of the GNU General Public License as6 J, U9 |! g$ H) v; O  `2 M- t
  17. * published by the Free Software Foundation version 2.
    1 @5 {$ I- m3 R! |
  18. *
    ! ~1 S& a2 g, e* u* A6 Q) M
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any$ C( L3 F& h' g# p
  20. * kind, whether express or implied; without even the implied warranty' u* b- t/ j8 H( _) n/ `+ j
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the, A" Q7 |2 Z) T4 ^  g
  22. * GNU General Public License for more details.5 I- @. b' Z) O: T
  23. */
    , h( G1 }* ], S- k$ ?. m. Y/ h
  24. ; {- d! V" a8 d6 ^5 Q
  25. #include <linux/module.h>$ d3 d# U: z; {1 \% J; c$ f( v
  26. #include <linux/init.h>
    - ?# E! M) V& s! n! t0 e1 s
  27. #include <linux/errno.h>8 G" U5 j& Q& r2 `" J, o  U
  28. #include <linux/types.h>
    9 e. n9 u8 U  ~7 E1 U
  29. #include <linux/interrupt.h>0 W+ {; i& \+ v% A
  30. #include <asm/io.h>  X" A9 I% N* z0 y$ o
  31. #include <linux/moduleparam.h>
    / p0 a# P* P& U5 v! q7 b& C
  32. #include <linux/sysctl.h>
    & L5 v5 a+ U1 y" W/ B6 ]9 ~: B/ A
  33. #include <linux/mm.h>  R$ q% ^- \  H8 d! a
  34. #include <linux/dma-mapping.h>: y0 d1 h. F5 F1 E* ?/ J) z

  35. * p5 H9 d. @6 J" e2 Z9 e
  36. #include <mach/memory.h>2 _/ j$ }; \* B4 {4 F6 h' a9 M$ [
  37. #include <mach/hardware.h>! a4 j" J9 a8 a  k: O) `
  38. #include <mach/irqs.h>$ {$ w7 T, ?' Q* N: Y
  39. #include <asm/hardware/edma.h>
    $ e! o1 P2 g3 T/ R: I$ j
  40. - T$ _% _8 a- n9 T$ |0 W6 i3 B
  41. #undef EDMA3_DEBUG
    : [; M0 b1 R: s' y5 l; X+ g2 M# u2 p
  42. /*#define EDMA3_DEBUG*/
    ! R' Z2 g9 r0 g$ f# w+ [9 y6 k% P& Z0 Z
  43. $ X- i" f/ \( x3 z& F; k
  44. #ifdef EDMA3_DEBUG( q$ k8 c% l5 {- P" e
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    ' [7 R" b! h+ _
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    * ?9 w4 z4 r& M; u* A% w3 h3 a
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    4 n! e; R2 g5 M3 g0 ^( f7 w3 |
  48. #else6 a$ k! L& x% U, y4 U
  49. #define DMA_PRINTK( x... )
    : V6 g/ q3 I( F$ p5 H$ \% E) z
  50. #define DMA_FN_IN3 i2 f9 E- `0 P
  51. #define DMA_FN_OUT
    # I! c. d. G+ [6 K3 {
  52. #endif( B' B6 e" J# U  o. i$ c

  53. * ?, g: j4 o5 q3 L
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    8 @0 S" Q1 K/ n/ q0 m
  55. #define STATIC_SHIFT                3' `/ u5 B& g' F( f
  56. #define TCINTEN_SHIFT               20
    / y6 n' e$ o2 ]7 k1 H% ~: [
  57. #define ITCINTEN_SHIFT              21
    * {1 a5 }$ |  M5 W& r
  58. #define TCCHEN_SHIFT                22" z: a3 D/ b& T( g" K' Y! F; {
  59. #define ITCCHEN_SHIFT               23, S$ S8 u5 X, s% J1 u4 L" b* p# x

  60. 6 Y1 W" p. Q: I, Q8 Y2 F
  61. static volatile int irqraised1 = 0;
    ) Y! T; o& k! x% C" G; I9 I
  62. static volatile int irqraised2 = 0;9 O% Q+ ^& r* f* Z

  63. 4 [% k* N3 R/ ^3 N$ X: F" E. e
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);# G! B9 h& a0 C. f
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    2 D# Z7 \' W: d
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    % ^& \! e+ _) F' V8 M+ T
  67. / O5 ?) [, Y" L" e5 G, Y, ~
  68. dma_addr_t dmaphyssrc1 = 0;
    ; H% |) t. W$ a6 p- ]0 N+ X
  69. dma_addr_t dmaphyssrc2 = 0;
    3 A& j# Y, k: ~! S
  70. dma_addr_t dmaphysdest1 = 0;
    0 t( t# O, P* J9 |- T* }
  71. dma_addr_t dmaphysdest2 = 0;
    1 P. v* _# M7 E9 T9 _

  72. 6 L$ Y. f1 W5 t: R& v7 ~& F, G1 g
  73. char *dmabufsrc1 = NULL;
    ' O6 M4 B* `" m& y1 B: i  B0 Y
  74. char *dmabufsrc2 = NULL;) u7 |: F4 V( L) c1 v# Q
  75. char *dmabufdest1 = NULL;6 }& D: w) w$ b5 c
  76. char *dmabufdest2 = NULL;
    2 F( l, w( f  K7 ~

  77. 0 F% r$ b: v; }* a$ I9 _2 @
  78. static int acnt = 512;  p( f: S2 w8 O! J  O4 P
  79. static int bcnt = 8;
    3 ?7 {# y6 m2 R& r+ B! K: P
  80. static int ccnt = 8;
    7 C+ X3 R0 L/ p, v' L& I

  81. * R* V5 p. w* A2 w
  82. module_param(acnt, int, S_IRUGO);: F) q- H# c, L0 t
  83. module_param(bcnt, int, S_IRUGO);* Q0 f7 V+ u* ~# _" P6 @
  84. module_param(ccnt, int, S_IRUGO);
复制代码
9 P( M/ G8 }$ e* \" E( b$ B' i

/ v/ ]& R, |  b$ p5 w- l1 D8 g      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用. O4 }; F& C) U' {! A1 i
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
# m6 }9 w0 i, a9 M2 w0 c/ Z     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。4 q$ U* `: {6 B" M. t/ T

) E. n- P+ ]$ m) a, Q2 O. j& Q; f# o1 B4 @; @! J9 C  E
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则


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

GMT+8, 2026-1-12 07:28 , Processed in 0.038190 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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