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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
7 z5 G/ Y$ @5 k) r8 m1 `) I
  1. [code]EDMA sample test application2 d1 q) ^- G+ d$ R. `( C
  2. /*
    " k; R) M7 a9 I# L- C& @, H
  3. * edma_test.c9 \3 ~0 ]  O$ Y  F% `
  4. *
    4 i% I8 q, R3 a3 K8 j; C
  5. * brief  EDMA3 Test Application
    ( ]$ T% S5 e$ _# u1 N1 y
  6. *9 Q, i1 G* U* `% F6 Q, _$ y
  7. *   This file contains EDMA3 Test code.
    3 R. r, N( F+ E- f/ G
  8. *
    & a, g4 G- y0 ^5 `
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    1 C+ t6 n8 N$ N
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    & b: H! N4 V5 u: ]6 D( w4 h
  11. *         TO CHANGE.' H8 H) H' h8 E$ F$ @8 e$ s
  12. *- n9 v1 U9 Q0 E1 C
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    8 _9 x, |* s0 b2 o/ R% m5 L$ }
  14. *
    3 G& h/ r; p- ~3 A3 }) s) F
  15. * This program is free software; you can redistribute it and/or
    / X" L( t# Q6 w% I7 D, Y2 i
  16. * modify it under the terms of the GNU General Public License as
    $ y( _( k# l3 `4 X" I
  17. * published by the Free Software Foundation version 2.
    9 i" \& B9 }) P2 C: x$ c
  18. *; U% i2 c% T/ t/ q) A3 }/ _8 B
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    & y7 I/ Q4 J9 f* K7 o' n) q
  20. * kind, whether express or implied; without even the implied warranty
    , S, z' a' f) D: y6 j& `
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the9 |6 Y. N8 W4 h9 _# i9 B, F
  22. * GNU General Public License for more details./ D/ [( l" ~) m4 }$ O
  23. */
    $ G: x) ^: g" j; K0 Y* \$ L" h6 E

  24.   ~* u/ b" a8 A6 c9 W
  25. #include <linux/module.h>
    * l7 v% Y6 `; f; Z* }) U
  26. #include <linux/init.h>
    / M0 C+ ]) u/ s( m# M+ |6 {. ?
  27. #include <linux/errno.h>
    ) l3 y1 E8 B" ^0 Y8 @! M
  28. #include <linux/types.h>% L3 Y1 y" B5 O. M# a
  29. #include <linux/interrupt.h>2 v* G* T2 k  R! a! M0 R+ I
  30. #include <asm/io.h>
    0 G/ n# I4 v" f" v2 _1 {1 q
  31. #include <linux/moduleparam.h>" l3 s  X- f( V* |$ Q' d0 g
  32. #include <linux/sysctl.h>9 _; s3 E* {' `* w
  33. #include <linux/mm.h>
    ; n$ n  O. A1 I
  34. #include <linux/dma-mapping.h>; |. X! y1 S& r3 S& i* v1 ^  i0 ~! D* i
  35. # c3 A& k6 a/ E4 r$ `8 U
  36. #include <mach/memory.h>
    " E' Y" M3 H# S" [) M5 R1 R8 e5 S
  37. #include <mach/hardware.h>5 W( u! @, n2 w: k7 v- w) _
  38. #include <mach/irqs.h>
    ; L( e& v6 h- c2 P/ D
  39. #include <asm/hardware/edma.h># t, A0 h" _. {0 b6 r  d3 y8 g3 M
  40. ) \* \/ U( Q* ^
  41. #undef EDMA3_DEBUG, H4 S8 E" ~2 W0 n
  42. /*#define EDMA3_DEBUG*/- T0 E% c& x0 A# Z/ r% }
  43. 8 q5 C/ w" N) K: f9 X8 D
  44. #ifdef EDMA3_DEBUG- j( J# w- F1 C3 Y1 I
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)" j2 ]1 P$ n7 x& P: s5 `
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)8 R1 p) S4 u, z6 t' m  k
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)3 Z4 w2 N; J! s5 q" W7 C
  48. #else  S* W+ a( O) [( ?5 d
  49. #define DMA_PRINTK( x... )
    1 H, E+ \7 l' V. j; P
  50. #define DMA_FN_IN1 I: D/ v2 x, L8 ?# ]; M; d  B- z
  51. #define DMA_FN_OUT
    9 m$ W0 K1 S/ x' q
  52. #endif
    - f: O4 G, A/ p2 {$ W  n7 y

  53. & d! D7 z! Q9 J: J8 H
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    : Q; k9 ]8 D% f8 T5 ^
  55. #define STATIC_SHIFT                3
    7 @1 ^" @! P# e9 J' e: z1 M
  56. #define TCINTEN_SHIFT               207 i. L: k% }  I- X, [8 K" m: o  w
  57. #define ITCINTEN_SHIFT              21% }6 L$ ?9 T  H) h" K6 e
  58. #define TCCHEN_SHIFT                22% Q- P! G" K4 X6 L
  59. #define ITCCHEN_SHIFT               23
    # Y& F5 z1 W+ X: U& k
  60. . U3 E) L( I) H2 e' Z' Z
  61. static volatile int irqraised1 = 0;
    ! y7 s0 k8 n, G8 y8 ?
  62. static volatile int irqraised2 = 0;4 O6 O; A4 F7 |- Q' z& T6 H

  63. 2 [& C' E9 z  P) k5 _! w
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
      a: E  n( Z5 s5 ?- _
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);1 M& k1 H- Q" [  h& z% X2 c' [2 c
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);# `8 j+ _* x1 J" I! h) V+ ]

  67. % `( e* {# ]$ i& g
  68. dma_addr_t dmaphyssrc1 = 0;
    5 ^, {$ z  D) X3 Y
  69. dma_addr_t dmaphyssrc2 = 0;! t! p# _4 b0 K% s, e2 x+ j
  70. dma_addr_t dmaphysdest1 = 0;
    0 J4 T$ w% r, D" ]- J
  71. dma_addr_t dmaphysdest2 = 0;
    2 V! W0 l7 T1 u9 @. [
  72. ' l- `5 W( l% B, o4 o
  73. char *dmabufsrc1 = NULL;! @8 {1 ~3 u2 {% l3 z9 H9 Q: o) |
  74. char *dmabufsrc2 = NULL;$ y, s+ t; ]& \( @
  75. char *dmabufdest1 = NULL;
    " e7 W* b! y  ~9 Z9 }3 V
  76. char *dmabufdest2 = NULL;. A5 S4 W8 L+ ^9 v

  77. ! I  p: S3 Y; v: }% f3 V+ T
  78. static int acnt = 512;: q, m/ {+ [6 z# n
  79. static int bcnt = 8;
    : W1 L1 N: \( }; m
  80. static int ccnt = 8;0 [; a  l, w3 ]$ `% w( l1 k

  81. ' a- Q2 {: [; {. J) R# T8 C
  82. module_param(acnt, int, S_IRUGO);
    & ~0 y0 F$ C7 y2 h1 C# M
  83. module_param(bcnt, int, S_IRUGO);) e/ e. ^' ^- H/ |
  84. module_param(ccnt, int, S_IRUGO);
复制代码

* K  n' r* o' E) @* g6 m6 r( e; M- ?8 w! Q+ n/ `+ ?
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
$ J7 o9 m% M, G* {; Farm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
5 z0 v1 F# i: Y% e: {9 M0 g     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
/ F1 }7 X4 q) J, _% G# k; B+ f0 q/ l: f7 S) \* }# T5 s; Q
8 n! Q  G$ ]# S' s# A6 Z8 y
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-12-26 23:21 , Processed in 0.038180 second(s), 24 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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