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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
! B( I- C' a6 t; b" Y/ P+ a
  1. [code]EDMA sample test application6 U$ j& h4 m0 v# g' @8 K
  2. /*, R( x( |. V$ q2 \5 A9 Z
  3. * edma_test.c  c9 y3 ]; v8 [7 E$ Y7 n
  4. *+ p( c, L% x7 {6 b
  5. * brief  EDMA3 Test Application
    8 S6 \! l2 Y. u+ \
  6. *
    4 _/ h. j+ z9 |% [
  7. *   This file contains EDMA3 Test code.4 D$ ?- \- o( N$ U* [. X  d
  8. *& T0 m8 y! f8 f
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE2 ?" B1 V$ {) A* r% {
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    - n0 M8 q  q0 U" F9 B! o8 o5 K
  11. *         TO CHANGE.
      t0 p" L6 N' M: s, v, p; Y
  12. *2 S. |; n( ?$ d
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/" k( P# q" T, Z4 @" u3 h
  14. *, D$ ]" [0 H+ u3 N% l- C
  15. * This program is free software; you can redistribute it and/or" r4 P% u4 G' Y
  16. * modify it under the terms of the GNU General Public License as3 ]' q3 @4 |# Y9 V: p* Q$ p9 \/ s& [
  17. * published by the Free Software Foundation version 2.
    / P& C5 @; s/ O$ s7 P
  18. *+ |1 e# T$ n- P6 t, {, O1 X
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    5 L0 P+ ~) K' o& t( X
  20. * kind, whether express or implied; without even the implied warranty
    / z' e) d; ]$ q8 _1 l
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    & u. z$ l: l9 v
  22. * GNU General Public License for more details.( k* x$ ?1 r% q. h' c2 ~, Y9 B
  23. */  L; `; I. b- }9 y) N1 c. l
  24. 3 _% O* j' o9 o& M4 u7 r, C
  25. #include <linux/module.h>' N4 Y9 j$ P& G9 A& b  ~
  26. #include <linux/init.h>* ^5 m0 u6 g: D
  27. #include <linux/errno.h>! [  J  c3 o+ d6 D
  28. #include <linux/types.h>7 W& |& K, P1 L$ A5 e
  29. #include <linux/interrupt.h>3 `. F2 t& w5 h9 v) C
  30. #include <asm/io.h>
    " m8 |7 g. w1 J# T$ s8 |
  31. #include <linux/moduleparam.h>6 s) B+ Z& S6 B- [' B9 ~
  32. #include <linux/sysctl.h>0 G% E7 q7 i% j  p! o
  33. #include <linux/mm.h>8 K) _1 C3 d/ r2 `5 D& ~9 r5 l
  34. #include <linux/dma-mapping.h>
    3 N6 }* N; ]' Y* M
  35. ) M1 f6 R$ i: A& B1 L
  36. #include <mach/memory.h>; u# b/ R2 V2 a: l$ ?: C3 ~  v2 v' \
  37. #include <mach/hardware.h>
    ! R$ w5 O3 j8 U; t* q% C
  38. #include <mach/irqs.h>. O* Z9 S9 I9 j( `: |/ w
  39. #include <asm/hardware/edma.h>
    4 S. Q. E' N) I
  40. " L: t( [) w# n7 p$ X& {
  41. #undef EDMA3_DEBUG
    + x- \0 K+ E4 m( e+ c
  42. /*#define EDMA3_DEBUG*/" f; t$ v; I4 _/ y: b9 E7 ?

  43. 1 K' }: K) j1 `5 l0 k0 K. G
  44. #ifdef EDMA3_DEBUG9 p/ P6 j1 M2 p8 d' \: V
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)0 r, A+ A6 p6 O
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__); J6 {8 s) M0 e2 g2 d: `
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    ( W% d, s- c0 l& [' r
  48. #else! b( j' i( v6 X
  49. #define DMA_PRINTK( x... )
    , H' ~, ^7 J( N5 e, g) ?! A4 x; ]
  50. #define DMA_FN_IN
    , ~; O( V+ y5 Y6 P+ e" C
  51. #define DMA_FN_OUT; @% P( h( k* g0 k
  52. #endif
    " B* v- b6 t, z5 M8 C( J

  53. & [5 Q- F& I% W* ^7 a7 G# N+ @
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    / V; K! F5 _1 {
  55. #define STATIC_SHIFT                3
    # ^9 i9 E4 j' i
  56. #define TCINTEN_SHIFT               20
    ) k: w* [! M: p; A2 ^
  57. #define ITCINTEN_SHIFT              21
    7 M' R, n3 k# m3 q7 c5 Z+ W" T
  58. #define TCCHEN_SHIFT                226 L8 s' x' k) e) m* z( N4 b+ C
  59. #define ITCCHEN_SHIFT               23
    2 N# Z* `: c/ f+ T( r: G, [

  60. + S$ `9 }* `1 T) C
  61. static volatile int irqraised1 = 0;5 L$ V: ]) Y0 @+ t" c
  62. static volatile int irqraised2 = 0;
      [! L3 j' d) @" s
  63.   q. B0 P4 G) D2 M) U' Y
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);4 G" m6 [) N( j6 Q
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    * }8 k* {5 i! L- D1 Y
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    % A; d3 g5 s/ v7 b
  67. 3 ]$ Y6 T0 p# U! o3 W6 J& o
  68. dma_addr_t dmaphyssrc1 = 0;3 d/ I% ^' H: c* v
  69. dma_addr_t dmaphyssrc2 = 0;
    # o8 P- `$ n% _" @/ M
  70. dma_addr_t dmaphysdest1 = 0;# V8 C/ |! U: g6 Q8 p( Z0 X" Z
  71. dma_addr_t dmaphysdest2 = 0;, `  s6 d2 o' C0 b: q8 @
  72. & R) F; P& x, K) l
  73. char *dmabufsrc1 = NULL;
    0 e2 x# D) H' X. W6 i; z5 g
  74. char *dmabufsrc2 = NULL;
    / C1 S$ k' m4 J9 d) c
  75. char *dmabufdest1 = NULL;
    , W3 _2 ~* R5 u7 K
  76. char *dmabufdest2 = NULL;
    5 {& J% h. Y* V4 L
  77. $ Z/ w2 U8 ]: P& F+ r$ x3 L
  78. static int acnt = 512;
    ' L, I; N) A( e
  79. static int bcnt = 8;
    ( ?. I: [; Q! q. h
  80. static int ccnt = 8;
    , v; f8 n+ M) g. z+ H8 y+ t' g& J

  81. . E% e) i' L- j3 [
  82. module_param(acnt, int, S_IRUGO);
    ! l" P4 `( B  O# M6 M: H
  83. module_param(bcnt, int, S_IRUGO);
      I1 F/ T% o. _! y3 E! N) Q1 W
  84. module_param(ccnt, int, S_IRUGO);
复制代码

# h6 ^' @) A" F7 _) p1 m
" v! E+ @4 `- k) j7 G      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
8 w6 W: K  c# W4 C5 tarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
! m3 u% P: ]( i6 ~7 P     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。) P- m" W8 q$ ?8 r1 P3 I8 X' O/ K4 \

; e' U, H6 I+ J6 y8 O0 K& B8 w9 V3 ^& g/ o# T( p* A7 ?
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-4-17 16:34 , Processed in 0.041088 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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