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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 ) M2 _( f  d2 }: n5 T
  1. [code]EDMA sample test application: [4 f2 v8 x4 Z, `) E, F* _) E& N
  2. /*
    ) s4 Z7 `" D; r' o$ m
  3. * edma_test.c
    ; W1 z9 }! L7 j  t2 K( B/ a
  4. *
    ! q0 }( B0 d! ]4 {+ J. B. \
  5. * brief  EDMA3 Test Application" Q7 w! S+ y  L# p% F) E6 F
  6. *- p( V. C& f8 S* J
  7. *   This file contains EDMA3 Test code.8 \8 i2 I2 _4 v2 N/ u- y
  8. *5 S( C6 O1 l! j! |
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    8 ?' w- t1 K6 w: W/ W
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    ; C3 t3 D0 L" A6 h
  11. *         TO CHANGE.* i% D, s4 u6 Q0 p4 a* B$ s# f5 h
  12. *# o+ y) ?2 q" L* [! _
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/4 C3 H' P" e- d$ {& P9 c) V2 W
  14. *7 \0 m) _$ E9 S
  15. * This program is free software; you can redistribute it and/or6 g* o- A" n$ h; m  p
  16. * modify it under the terms of the GNU General Public License as# Y& m8 {/ Q) Z# n" S! R
  17. * published by the Free Software Foundation version 2.
    7 i1 ?- x* X. Z0 V
  18. *
    . D3 W% R; x8 l, i5 d6 L5 k0 Z- z
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    , n1 {) D" J/ \( |; ~; H0 N* H
  20. * kind, whether express or implied; without even the implied warranty% e. m7 T3 e% G* S/ N2 Y1 a
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    3 U( m( I1 D8 N1 |3 _% y3 E$ M  w$ g
  22. * GNU General Public License for more details.
    : @0 u: y7 t- O1 V7 Q& @' J4 q
  23. */
    4 f% B% G. N. K) x
  24. " x7 c( }+ D8 O) e# O2 `
  25. #include <linux/module.h>
    ' _4 Z" i  q( P7 R/ |- ]
  26. #include <linux/init.h>4 _$ I: I% {; X% k( r! E3 {3 n
  27. #include <linux/errno.h>
    7 S, l7 ?) r  H6 P4 l' u+ v
  28. #include <linux/types.h>$ Q4 [  W" W0 P/ b# ~
  29. #include <linux/interrupt.h>/ t  ^3 U, i( S6 z8 o4 G* `5 |
  30. #include <asm/io.h>1 [* D# z4 b- j  V! B4 [4 y
  31. #include <linux/moduleparam.h>2 z4 Q: @6 I) w0 |% W2 b
  32. #include <linux/sysctl.h>
    : w0 ^, K5 ?( I" s3 X) m
  33. #include <linux/mm.h>
    : s( q$ @% J! F& d
  34. #include <linux/dma-mapping.h>
    6 e# V% c- g& s
  35.   |3 D. L6 }) M+ Z0 H8 u
  36. #include <mach/memory.h>
    % m3 Y+ ~+ g6 ^6 S/ c# i  g
  37. #include <mach/hardware.h>
    . Q9 i2 N; `' O2 L0 s& t0 ]
  38. #include <mach/irqs.h>
      B  B0 Q; }) F& E. V7 B" W
  39. #include <asm/hardware/edma.h>
    ; Z" V! y& h& B

  40. * J5 F; Y: w0 R3 y  e
  41. #undef EDMA3_DEBUG7 l: R7 H- n% u+ M2 ?
  42. /*#define EDMA3_DEBUG*/% D7 d# ^  k! o: u- t
  43. + C6 n8 d& Y+ }  W; W7 f6 g) @5 \
  44. #ifdef EDMA3_DEBUG
    ; ?1 P1 q4 A- S4 V1 D; x
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)2 U+ H9 b2 \, X6 q
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    " p; n, y+ C9 O6 C, G
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__); S) p# t* K" M4 Z
  48. #else9 y& ?4 V/ I2 `- A- a$ p$ |
  49. #define DMA_PRINTK( x... )% R8 I( B9 d5 Y# [$ w
  50. #define DMA_FN_IN0 ~- j: @. W% t* a+ k- l
  51. #define DMA_FN_OUT
    8 r* o6 ?6 k; W% i
  52. #endif
    4 e2 F7 B3 o( o) T+ `
  53. 9 s3 n+ R+ e2 ~6 {$ |, x
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)/ C4 ^+ J1 h. j; ?, I/ ^; c! n' d
  55. #define STATIC_SHIFT                3
    * a0 f! h! U& v2 G( @3 F' E& g' v/ M
  56. #define TCINTEN_SHIFT               20
    . m9 z* D* C4 d% k6 x# M
  57. #define ITCINTEN_SHIFT              21
    ! \: P0 w4 a. {; a
  58. #define TCCHEN_SHIFT                22
    . E" F0 J9 C' C
  59. #define ITCCHEN_SHIFT               23
    ; `, a) ]) ~, z) s1 k
  60. - h2 J' r" ]3 Y5 {5 _/ p) w
  61. static volatile int irqraised1 = 0;
    $ H9 H8 _* g; c0 A% b$ y
  62. static volatile int irqraised2 = 0;$ q. x0 z) e8 K8 u; D( m6 U

  63. , {; z8 q- w. o( S; ]
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ) ^& m+ F2 s6 Z- u0 r
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);( w4 O. [6 M# y( L/ a
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);- Q* i" }0 a1 ]6 l# m% r+ r
  67. 6 P0 B, |0 ]8 u. T7 f
  68. dma_addr_t dmaphyssrc1 = 0;
    ) }: v9 E" ?; r7 z- L
  69. dma_addr_t dmaphyssrc2 = 0;
    4 L8 ]/ U* M9 I+ t4 M) X
  70. dma_addr_t dmaphysdest1 = 0;. K* o! x! w' I+ y. L
  71. dma_addr_t dmaphysdest2 = 0;
    3 H$ _4 c7 \6 C# Q8 k/ a
  72. ) P* x" k# J* R4 ~' ?/ E
  73. char *dmabufsrc1 = NULL;& D$ l( u% t, a2 b1 b
  74. char *dmabufsrc2 = NULL;
    ; z% r6 C. d( a$ t. Z0 j
  75. char *dmabufdest1 = NULL;( P$ P8 {1 N, C8 B7 C1 G
  76. char *dmabufdest2 = NULL;
    + v  N! J$ n; O! l9 y- k! t
  77. " J0 p$ J/ }& F" H8 E) G
  78. static int acnt = 512;
    6 e; l& ~4 G8 m2 w# t6 f' }
  79. static int bcnt = 8;3 d  P4 }4 @# n0 x' \2 [
  80. static int ccnt = 8;  U4 G* ?3 c6 u

  81. : A* S* b& k! E- @& ^$ T8 ]5 e+ `
  82. module_param(acnt, int, S_IRUGO);
    ( R$ h3 Q: M" f+ |5 \
  83. module_param(bcnt, int, S_IRUGO);7 s8 d& j! z5 \* Q3 h9 k
  84. module_param(ccnt, int, S_IRUGO);
复制代码

3 Y% n2 E) f5 G7 [3 B8 \7 Y+ r' F" x/ f0 `. m7 k* `, j, k
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用, b- Q! S! ?+ N% Y' [
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
& l  i$ Y  Q" @1 |0 n: v5 k( P     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
: S/ j$ ]6 N: T; M& Z* H. ]
& L3 v; d- D; B" W2 j/ r1 P1 T" @& j
% O5 _' ?8 x" {6 }
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-2-13 21:24 , Processed in 0.040659 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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