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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 2 ~% ^) ]3 R6 Z0 G
  1. [code]EDMA sample test application
    ; q& L7 V# |9 X( q. _8 D  P( A9 \
  2. /*! f, k/ n  h" Q/ n0 e) H
  3. * edma_test.c. M6 w  u7 ]2 _3 c: t+ s3 H
  4. *
    9 S9 Q- v+ p! E" {0 J( \
  5. * brief  EDMA3 Test Application
    ) N* `3 }7 ~$ i
  6. *
    : F1 ?. ^9 x6 h8 o4 ~4 p6 E
  7. *   This file contains EDMA3 Test code.
    : N+ K( E, S6 l8 x; `
  8. *3 d, E5 b4 s: s7 U6 W+ U" ~
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE- \" b! Z2 h, @: V: m0 n: ~
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    0 `& I8 |* ?% w$ N
  11. *         TO CHANGE.0 z$ q! y# g; [2 x" f2 O
  12. *  G) m; Y- x5 e/ j2 V9 j, k
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    5 Y: }9 s& X0 X  `+ f
  14. *4 h: E" t+ O! c0 V, x; H& ~9 J
  15. * This program is free software; you can redistribute it and/or
    . x5 p/ D" f- x! k% ^5 t
  16. * modify it under the terms of the GNU General Public License as* M+ W5 o' o. Z* a
  17. * published by the Free Software Foundation version 2.
    - [# A( P/ r2 l! f
  18. *
    + a9 o$ y- z8 @" l8 `2 |$ g% _
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    3 I8 V! z) r  I7 @6 z! [2 c' L8 g
  20. * kind, whether express or implied; without even the implied warranty
    8 n7 d0 Z* Y3 F  j2 c5 p
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the5 W/ B0 ~$ X! U! M4 l: k8 o
  22. * GNU General Public License for more details.
    + u7 T( U$ p, a: x' r+ k
  23. */
    4 x, T8 ?5 |( g0 Q) h
  24. , C0 x) Z  g5 I' c: V' n# a
  25. #include <linux/module.h>0 m7 h: j) [5 A! n* W: }5 W& W
  26. #include <linux/init.h>7 R: w  n0 z1 b9 a( j, {& q
  27. #include <linux/errno.h>9 d7 b6 Z- q& {
  28. #include <linux/types.h>
    ) E! l; l6 r9 w+ T+ l) g$ g
  29. #include <linux/interrupt.h>' d6 I# \9 L+ W1 W
  30. #include <asm/io.h>( O5 U2 X& [0 E4 n, }
  31. #include <linux/moduleparam.h>
    9 K" F/ g7 I! t) f0 W. n
  32. #include <linux/sysctl.h>5 f/ ^) K1 K, ^
  33. #include <linux/mm.h>. \, V8 U! d' I% C  p/ u
  34. #include <linux/dma-mapping.h>9 H1 ^/ p/ G2 e
  35. 2 q4 W8 k8 ^, ~  V0 ~
  36. #include <mach/memory.h>) S5 h4 t; G- B1 c
  37. #include <mach/hardware.h>
    " d3 o- Z) \1 X
  38. #include <mach/irqs.h>
    9 S' `/ f- U: _* |- {2 m1 X, U) |
  39. #include <asm/hardware/edma.h>
    3 v6 C- ^2 t% x* z8 Y- Z' a

  40. ! v" a6 u% V% a: U5 _* H8 E
  41. #undef EDMA3_DEBUG
    2 E% V3 X/ k6 D5 o- [
  42. /*#define EDMA3_DEBUG*/
    1 u( `3 {$ X8 v  Y2 m/ N5 w) H8 u

  43. ! T( T8 l3 L" n, o. i. b3 T
  44. #ifdef EDMA3_DEBUG
    # p  v) I6 [3 H6 i
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)) ?8 M0 k; e, E# j- t! A9 H
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)6 F' U( Z5 b; |  X, p# E; X) i5 X
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    / u, M! j, q* V  D1 K- G8 [
  48. #else
    5 b/ b. c# M4 d
  49. #define DMA_PRINTK( x... )7 ^8 M+ S$ D) Y
  50. #define DMA_FN_IN- X+ q5 q: L5 T" N
  51. #define DMA_FN_OUT
    ; v; y$ Y4 p' `  N" ^6 B
  52. #endif
    ! R9 D) J! v: Q2 ?
  53. $ q$ g& X6 n9 x) l$ U
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    3 }. E% e! |% D
  55. #define STATIC_SHIFT                35 K, X* L* }) s- x4 \3 g0 z9 n4 R
  56. #define TCINTEN_SHIFT               20( U- g0 T+ x6 M' ?& K
  57. #define ITCINTEN_SHIFT              21: M* j3 R5 j0 n! ^9 u  m
  58. #define TCCHEN_SHIFT                22
    1 s( s8 w- @) A
  59. #define ITCCHEN_SHIFT               23
    + f! v7 U$ U2 B) C) ]# S
  60. " X& q6 p4 X+ x
  61. static volatile int irqraised1 = 0;' ]3 C, g! O- C& l0 [( h6 G8 p6 G7 V
  62. static volatile int irqraised2 = 0;
    4 u- d# P: c$ v! x

  63. - C, o8 V+ D7 s( V0 F
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);$ v) d! ?8 Q& ?4 d3 e
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    * |6 ~3 O, ]7 I7 v
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    2 @/ S2 X" P9 Q( s7 O9 L3 h

  67. * v0 W. P" z" L) r2 i2 E5 o
  68. dma_addr_t dmaphyssrc1 = 0;1 S  [& K! j% I2 C' d! r* a# N8 r
  69. dma_addr_t dmaphyssrc2 = 0;
    3 ^4 K. v; }% o7 e1 f9 C
  70. dma_addr_t dmaphysdest1 = 0;
    4 ]8 d# h$ p, f  d- E# |/ m
  71. dma_addr_t dmaphysdest2 = 0;
    : j/ O9 j7 C* D

  72. 1 b. `+ k6 E4 G4 B* A2 S
  73. char *dmabufsrc1 = NULL;
    + N6 J3 T* X  h0 a- W
  74. char *dmabufsrc2 = NULL;
    * H$ j8 v- G) W% L
  75. char *dmabufdest1 = NULL;
    5 q8 `( E5 W" B
  76. char *dmabufdest2 = NULL;5 j( |, b, ~! {2 {4 R$ ]' ?

  77. 0 [$ ^; c- w, z0 W0 U! M
  78. static int acnt = 512;
    8 E" x* k; S) H/ S* e
  79. static int bcnt = 8;; u1 c, _9 N( a! N. n! v0 B: u3 X% t
  80. static int ccnt = 8;
    ( W" U* U# \( V+ {. M

  81. 8 Q# Z6 v* t) T5 G( C' m4 Q
  82. module_param(acnt, int, S_IRUGO);( l6 c; K" m/ T) A9 O
  83. module_param(bcnt, int, S_IRUGO);9 c$ w) \- l  k+ x& A5 B' N: G, u8 p* w
  84. module_param(ccnt, int, S_IRUGO);
复制代码

' @0 x$ O. u- J) t. |% t7 p. L7 i) b% N) {
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
) @6 M) U- S6 n1 yarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。* o9 d# s" ^* ~) ?/ z
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
9 ?9 l$ H6 V' O( }3 s4 k& }
' R" V3 }5 A) J3 \  b0 k. ?% Q% q
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2024-5-8 10:53 , Processed in 0.035620 second(s), 24 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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