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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
3 k( f: A: p4 e% b, m
  1. [code]EDMA sample test application
    ! |1 z" c- m3 F1 I) G! G" w
  2. /*$ F3 |( Y9 o( R" p
  3. * edma_test.c
    * a) V6 ?3 Z2 H* C
  4. *: \) `& }: }6 S: f. Z
  5. * brief  EDMA3 Test Application
    2 ]" K4 k: D' ^3 m$ l2 \4 g8 _
  6. *
    9 H: x1 ^7 D! n  t9 A
  7. *   This file contains EDMA3 Test code.- ^8 Z' C' @% N& w' V
  8. *
    / Y% D: f  ^  Y- q
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    1 Y8 D- f$ _1 Z
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    : g" }- B5 }( G8 R3 z" N7 o' b
  11. *         TO CHANGE.
    * U% z- b' e3 A) K( {. T/ N+ J
  12. *+ Y8 h7 }# f/ ?8 V, Q
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    4 Z: ^3 n; _8 N0 X) L
  14. *
    7 d. r2 ], u7 ?- q* r' Z. ~
  15. * This program is free software; you can redistribute it and/or
    9 q* v' y! G* o: C
  16. * modify it under the terms of the GNU General Public License as
    0 @4 d2 G( `) h3 n  T+ Q
  17. * published by the Free Software Foundation version 2.: h6 @3 y% B; n; T+ R) j" V
  18. *) g& y7 ]6 H& ?' v
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    2 f( E( R: Z+ g
  20. * kind, whether express or implied; without even the implied warranty' R) p4 m0 S) N7 i- w! A
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the7 @8 A- g5 p$ ]. f
  22. * GNU General Public License for more details.( k* H, U# v; E1 C0 Z
  23. */
    % H) F6 Z6 Q' A& |, s0 ]

  24. & T0 f# t8 O, [2 ]
  25. #include <linux/module.h>
    & z+ e3 P$ j, S0 C
  26. #include <linux/init.h>
    $ @# P9 g2 p- R& M$ {! E: C
  27. #include <linux/errno.h>
    : G* \/ C* @9 G# O
  28. #include <linux/types.h>
    3 m1 d* ]7 s  w1 V4 l3 F/ o
  29. #include <linux/interrupt.h>) e1 ?1 e& O9 f$ [* ~5 P
  30. #include <asm/io.h>) L* O6 X+ k1 d' t; i
  31. #include <linux/moduleparam.h>
    $ \) r) t, Y6 A( ]
  32. #include <linux/sysctl.h>
    6 l/ M: _9 c0 u
  33. #include <linux/mm.h>
    9 K. {* B1 V3 L) D
  34. #include <linux/dma-mapping.h>
    ; i5 j* W& q) X, l3 Z
  35. / D# s% Z# P8 \
  36. #include <mach/memory.h>, S0 _1 H! a: T. V& |
  37. #include <mach/hardware.h>
    / p" d: Y2 D, ^4 z* E
  38. #include <mach/irqs.h>
    ; x, U) ]3 a$ ]2 d$ g: H5 b  v7 G
  39. #include <asm/hardware/edma.h>5 R) `5 ?- d" q- Y! w0 G( b8 s" V" g

  40. 1 _6 }0 \5 R1 Z& L2 g/ }6 c
  41. #undef EDMA3_DEBUG% R& T7 d8 H3 ~' x8 B  `* g
  42. /*#define EDMA3_DEBUG*/
    : s9 t  @8 T; k% W+ }
  43. 4 l+ i! I6 l9 C, v' U
  44. #ifdef EDMA3_DEBUG8 j3 f8 E( X% B$ J6 y1 |
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)% V% L* S  E3 D, t% D9 l' @" S3 X
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    * |7 Z2 t$ z$ m/ m9 z  b4 W4 C
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__). s1 A1 L5 U5 y+ x1 \0 {6 \: ~
  48. #else
    2 v1 M; ~# V8 _$ I
  49. #define DMA_PRINTK( x... )6 p; V" W, J( Y! s9 f. v& f
  50. #define DMA_FN_IN3 g3 S" m" M+ \+ w6 ?2 W
  51. #define DMA_FN_OUT
    $ H: a, p! w, s" E
  52. #endif/ H6 z2 j8 t  M$ [" P
  53. - p3 G% z5 C1 K; e6 m6 m
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)% V3 ~9 j  S, n3 \, \% ^
  55. #define STATIC_SHIFT                35 p% O) u; K# `. E6 U
  56. #define TCINTEN_SHIFT               20- \* W1 y7 p( P" N- `
  57. #define ITCINTEN_SHIFT              21* D" \( b5 E$ q" r5 r6 y2 m4 D
  58. #define TCCHEN_SHIFT                22
      F# k$ W& ^2 r" w5 z
  59. #define ITCCHEN_SHIFT               23
    1 Y7 z7 W! a) ]0 u, j( b. s
  60. # s% Y0 s* {* O0 K6 k8 J) w
  61. static volatile int irqraised1 = 0;
    8 K% S: r9 z- T4 S
  62. static volatile int irqraised2 = 0;# k9 I/ l( }/ E9 A6 K. e

  63. 3 M  ^4 [+ t7 j8 A+ X! i
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    : C/ H- f- W1 E+ U( [
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);, U3 O' o9 Z% a
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    " l$ n2 F! I8 N+ Q! ~7 h" o/ b

  67. " F0 f2 `$ n3 D1 R- P6 H2 g$ k
  68. dma_addr_t dmaphyssrc1 = 0;
    ( z* p2 u3 L+ _& \+ J6 u* P# P- `
  69. dma_addr_t dmaphyssrc2 = 0;
    ) A& Q7 B" f* A
  70. dma_addr_t dmaphysdest1 = 0;, R$ G# f" s. E  ?! P! N' o; C9 B
  71. dma_addr_t dmaphysdest2 = 0;* @3 P9 k7 x0 x# f
  72. 3 G7 V' ?# n- d. E" @
  73. char *dmabufsrc1 = NULL;0 w' e% c7 W: q9 f1 E
  74. char *dmabufsrc2 = NULL;- g; r8 U7 `: A8 \3 W3 |2 |* {
  75. char *dmabufdest1 = NULL;, E) T/ D7 X, a. h  g- D5 ?- N) A
  76. char *dmabufdest2 = NULL;
    ) g0 l  R+ K4 y: ~4 Z
  77. 8 _2 j) n1 t9 j" g& c3 b
  78. static int acnt = 512;: I! K1 p% d+ W1 k) ^
  79. static int bcnt = 8;7 H0 V; [+ X- i& L
  80. static int ccnt = 8;9 h9 q$ A, d- F2 C6 S% h
  81. ' V5 D1 |: O, W$ c
  82. module_param(acnt, int, S_IRUGO);; W3 A6 Z$ Z! m6 y: s' {
  83. module_param(bcnt, int, S_IRUGO);
    ( e, ]6 t5 J: H2 e
  84. module_param(ccnt, int, S_IRUGO);
复制代码
# v. z( b' H/ S- q/ s
8 y  s/ T# q: K6 R) A) J8 F
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
* W5 U2 P* Q. earm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
/ U* Q+ {% n5 n+ ?. B     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。/ L3 h4 P" \0 `. w1 x' x% l' ^
7 `: V( @0 e# C6 d
4 U. k+ S/ r/ [: l: d. }, s
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-2-17 11:03 , Processed in 0.038462 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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