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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 8 f- j7 P. L5 d: N8 `: {0 S
  1. [code]EDMA sample test application" C$ ?. S' k3 `; Z- X/ {
  2. /*
    / r; v% T# P6 q* G
  3. * edma_test.c
    ' D7 G; S, w& A- n$ m% Z6 \3 Q
  4. ** I. {) q* R# j
  5. * brief  EDMA3 Test Application
    9 Z, s. N3 \5 @8 y
  6. *" w" W1 E& d& b0 @$ n
  7. *   This file contains EDMA3 Test code." ^7 ?+ p, ]" H% i
  8. *; y8 _6 ?7 \+ `$ F5 }
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    ! \* Z3 P. m! s/ U! _
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT( O4 e. }& _" p, [6 t
  11. *         TO CHANGE.5 i0 F7 ~  K9 B
  12. *) m3 g3 {7 o3 k
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/% v) c$ e( t& ?1 H
  14. *
    " o  R2 b: R7 x; ^1 H8 n: L
  15. * This program is free software; you can redistribute it and/or
    ) D/ ^0 F( n  ?" O3 b- W
  16. * modify it under the terms of the GNU General Public License as
      A# V. m( \. M% \$ [
  17. * published by the Free Software Foundation version 2.
    8 E; P: w( k3 t  {5 S6 M, |+ K# z
  18. *
    - H9 E2 ?( h" ]1 ^& H! u+ R1 x
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any3 Y; y3 i2 [7 u- D9 r
  20. * kind, whether express or implied; without even the implied warranty
    - [( `" [0 R7 g/ F
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the- O8 h; M( o: K! M/ x0 k
  22. * GNU General Public License for more details.
    $ U# `& a4 X7 w/ N
  23. */
    , Z. e# [# G* k9 R# j" b
  24. 6 U3 n( [+ F/ X" A! a* G: X* w7 l
  25. #include <linux/module.h>
    5 o2 k# b1 H+ |6 a  f0 C
  26. #include <linux/init.h>
    / t/ c! X  i. J4 A. q! ?* M
  27. #include <linux/errno.h>  s# K1 |. d2 S2 x! l
  28. #include <linux/types.h>
    ' d$ z& R( K8 Y; X
  29. #include <linux/interrupt.h>
    * n8 x, r) S$ r6 J- j+ L
  30. #include <asm/io.h>
    ' G, L% P+ h. t# y# |7 s5 T  F
  31. #include <linux/moduleparam.h>: `- s) P6 ~0 b& o8 N
  32. #include <linux/sysctl.h>
    ! n. \: `+ L% U7 A1 k! k. }
  33. #include <linux/mm.h>% c5 S: Z5 B  X/ Q9 k+ Q' R# q
  34. #include <linux/dma-mapping.h>$ o7 e; u7 u. j2 Q& C% q2 f

  35. , V' h% R- ^" y+ Q" q' ~
  36. #include <mach/memory.h>) r$ Z4 B7 e) n' N0 S% U
  37. #include <mach/hardware.h>1 v+ O3 j: a0 B; s, z
  38. #include <mach/irqs.h>
    # W; ~3 f/ V  e
  39. #include <asm/hardware/edma.h>  Q# U- Q  p* S' l  w9 @6 R2 o

  40. " g0 v$ ~4 v2 _
  41. #undef EDMA3_DEBUG# ?9 [0 c) O% t7 g2 e" g
  42. /*#define EDMA3_DEBUG*/
    ( `8 \$ K; {9 A# k( C& S& i+ |
  43. % q# w- D8 b# P0 ?, i
  44. #ifdef EDMA3_DEBUG
    # H- F  x% ]" z" a7 `
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    7 ~$ ?1 {9 o2 Y( O
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)% p3 T( Y- u* l4 Z& r3 Z8 v4 h
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)  ~8 r1 @4 d: K1 w: K7 {$ t, \" l
  48. #else
    - U' N) v; e. S
  49. #define DMA_PRINTK( x... )8 ]1 r1 V: h4 \  r
  50. #define DMA_FN_IN
    7 A( @7 q4 I4 ^6 Q- q4 O0 @
  51. #define DMA_FN_OUT$ v3 v* F2 d( l8 c) ?5 k  @/ C* z. j
  52. #endif  D& c$ h$ W% `$ D* V. Y1 }

  53. , X4 b/ M0 Y; O7 t9 v! j! V/ J: x! r
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    9 c5 C  C% ~. o' N
  55. #define STATIC_SHIFT                3% O, X  S2 x7 @% j4 I
  56. #define TCINTEN_SHIFT               20
    0 E! N8 o& F! U" Z, t) R; [
  57. #define ITCINTEN_SHIFT              21
      U6 k( R# T: V- e; `" ]0 n
  58. #define TCCHEN_SHIFT                22
    ' W$ l) D; Q3 _
  59. #define ITCCHEN_SHIFT               23
    6 F& E6 ?9 ?9 s- m: h! e, n7 L

  60. # q- Z- v* p" x. z" D
  61. static volatile int irqraised1 = 0;
    - \7 l5 z/ S* c: K. t+ j/ b" G) k
  62. static volatile int irqraised2 = 0;
    / P* d& d) ?0 J3 G7 K; G" x" o

  63. ( |' a/ K3 E$ {% m3 n0 T- M
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);0 \: v# O" i, g6 }6 t
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);: {+ G  k' c# y& e* a0 ]; Z: G
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    / N" S4 P. [% A7 E' [
  67. , N* `' f1 \: {: n3 _0 Q4 l+ N
  68. dma_addr_t dmaphyssrc1 = 0;! q5 `8 Q+ f: Y! {
  69. dma_addr_t dmaphyssrc2 = 0;
    / S+ g2 f( u$ B! ~
  70. dma_addr_t dmaphysdest1 = 0;0 F& s$ O& C2 W* F% m6 k$ |
  71. dma_addr_t dmaphysdest2 = 0;& h% `3 J5 B) ~6 t9 G$ c" r; Z

  72. ( P+ }8 [% r! d6 f# |& I2 @
  73. char *dmabufsrc1 = NULL;4 f8 R& a, w4 S1 ~# u
  74. char *dmabufsrc2 = NULL;( c) ~+ P2 ^, J# f) j2 p
  75. char *dmabufdest1 = NULL;
    ; a8 ]4 a; B1 m  p9 D( D3 b
  76. char *dmabufdest2 = NULL;
    # p: D9 c" Q' ~5 |1 j2 d5 ^

  77. + M$ q# {7 J, U( R. C# Q( {% j
  78. static int acnt = 512;
    6 v! @: {+ b- \" s$ P
  79. static int bcnt = 8;
    0 U1 q! W% ]2 M* I( l
  80. static int ccnt = 8;9 n; L# P% L' `3 ^% B
  81. " {7 @& Z# R& q; p$ t
  82. module_param(acnt, int, S_IRUGO);- E. g7 T" g& B" [5 B0 V; v0 R* W! o
  83. module_param(bcnt, int, S_IRUGO);
    % r, e* K, l: r
  84. module_param(ccnt, int, S_IRUGO);
复制代码
: Q# R6 E) m; `+ I

- d) f% I* L# d! J- C& Z/ }1 X      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用% X1 K0 L" F2 ?! z' J
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
3 x* q7 r( X7 ?9 z9 ~9 c6 z     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
- `' k  E; P2 p  m, q% h0 d1 B+ T$ O1 w0 Q7 m, T* n) U) D! V
* ]8 u  ]2 ~" c7 S4 u
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-12-24 19:28 , Processed in 0.037081 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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