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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 # @5 J7 H$ W6 ^3 j# A
  1. [code]EDMA sample test application
    6 G' c* Q) k" L9 F  r0 W" U. z
  2. /*
    7 V. M. L* S" y8 I: K' `/ F
  3. * edma_test.c2 x6 u) y6 a& F; n+ p4 Y5 v
  4. *: ?$ |) i- k' f
  5. * brief  EDMA3 Test Application
    8 p& w5 c, m' O8 Z
  6. *
    ) Z8 r* h- q" q0 i
  7. *   This file contains EDMA3 Test code.
      J5 `) a+ @1 }# Z1 [8 G# \8 C
  8. *+ i8 q) f: ?8 |2 V+ i
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE, n/ j$ w( X$ [; V5 g% G: P! Q
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    7 |' u" c' a& X2 c
  11. *         TO CHANGE.3 W6 ?4 B! [( ?7 d
  12. *
    / O, G  S# \$ b5 I
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    0 z; M# {4 X; ^& ]/ |
  14. *
    " J( F6 V: w9 B: y1 k1 |
  15. * This program is free software; you can redistribute it and/or
    * p! b2 F9 G9 V& R) r* e: S# F
  16. * modify it under the terms of the GNU General Public License as; Q( B1 u" @# ^: q8 t; V& O
  17. * published by the Free Software Foundation version 2.
    0 m: y8 C; |6 S: W
  18. *& t1 R+ ]7 c  t7 b1 _' M% E7 W
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any1 H; ?+ s$ Z" L
  20. * kind, whether express or implied; without even the implied warranty8 E( T# _  m; h* P8 P  i* ?
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    8 ~4 X3 D  u) g
  22. * GNU General Public License for more details.& }  {7 S: w8 E; x# d7 Q1 G
  23. */4 t+ x+ l5 a2 [
  24. 0 }! y' k0 w3 \, i! l( ]$ `+ `# P
  25. #include <linux/module.h>
    - F+ X# W& p. \; k0 K8 t, c! Y
  26. #include <linux/init.h>
    3 ?7 V5 ^2 S& q7 u& G
  27. #include <linux/errno.h>
    & d+ t/ G1 v  Y
  28. #include <linux/types.h>
    + P  e2 u: c. E% q$ V; z
  29. #include <linux/interrupt.h>: r! K9 }( O, N1 \; u" c& }: ?
  30. #include <asm/io.h>' f3 F! T5 S5 h& [3 u4 U6 V& H
  31. #include <linux/moduleparam.h>
    9 C" X- d: T+ q! H
  32. #include <linux/sysctl.h>0 a6 W, n1 w2 k$ x& `
  33. #include <linux/mm.h>
    8 N4 M; M9 L& e1 S" |2 R5 h
  34. #include <linux/dma-mapping.h>
    - D! K7 M* P+ i' R: \
  35. ; ?( a$ \; x, l7 K
  36. #include <mach/memory.h>$ U3 g- g' k3 s4 d( ^
  37. #include <mach/hardware.h>
    . ?' U) x$ ^2 F
  38. #include <mach/irqs.h>" o: w* B" n$ _- x! D
  39. #include <asm/hardware/edma.h>
    6 X5 q- c! R6 i: k
  40. / t$ C% d4 P! C; J  c) H3 |
  41. #undef EDMA3_DEBUG
    + e5 }" C( [) {9 q5 j. K
  42. /*#define EDMA3_DEBUG*/
    9 x& V$ P7 F2 ?
  43. " P: G2 k6 d# R# K1 J" s* K9 `
  44. #ifdef EDMA3_DEBUG
    ' v6 n: b$ `( a" M
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    7 I* _; o- b1 \0 Z0 ?+ x: i+ p; h
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)& T" Q, a" T  Y/ A
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)  Y  B) h2 u" Z, A
  48. #else
    5 q$ T, h, k) C
  49. #define DMA_PRINTK( x... )- I  K4 [9 p. t
  50. #define DMA_FN_IN
    ( M7 b+ }' K; h! M9 {2 A
  51. #define DMA_FN_OUT
    - c6 t; `" [9 s, Z
  52. #endif2 Z: e5 z' c& o& `& \! t

  53. 3 f9 v2 E1 \* _
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)9 s& P0 m* t( ?0 `- d7 @+ g
  55. #define STATIC_SHIFT                3" n* _, E! w$ _0 O; E) w
  56. #define TCINTEN_SHIFT               20% R. \5 r) e0 o6 I
  57. #define ITCINTEN_SHIFT              21
    ) G  y' T' `5 Y( @# C9 i
  58. #define TCCHEN_SHIFT                22
    ; h- ~; v  W4 k0 e) x6 ]' \
  59. #define ITCCHEN_SHIFT               23" T1 x" h5 N2 B8 l# \

  60. # W1 p% h- X9 k; L% a9 r2 ?) [
  61. static volatile int irqraised1 = 0;
    ' W) `; [5 L" o
  62. static volatile int irqraised2 = 0;
    $ u: O; O/ w  H" ]$ g' v7 S1 X

  63. 1 v; c- b: a$ I4 F& c, ]0 O
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);) n2 y7 o- B% f, s* s7 A5 i$ ?* f
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    1 j/ T5 q. _% q8 H' F# a
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);# J! r; i* x' r, B' u  }
  67. 2 R: o9 _+ x, p
  68. dma_addr_t dmaphyssrc1 = 0;
    : ~5 d0 }8 g8 W4 T
  69. dma_addr_t dmaphyssrc2 = 0;
    4 u8 Y: f; o" ^4 C& \" R9 G
  70. dma_addr_t dmaphysdest1 = 0;
    * m$ {8 n* i: B6 W# Q  ]
  71. dma_addr_t dmaphysdest2 = 0;
    - A8 ]3 O" \# o5 [) h
  72. 1 W% e$ ]! i/ e- ^- k- a$ [: R
  73. char *dmabufsrc1 = NULL;3 f" A6 m0 O; |6 A" u6 a
  74. char *dmabufsrc2 = NULL;
    : C3 X2 C' J0 Y5 r+ @) p2 q
  75. char *dmabufdest1 = NULL;
    9 w. Q! `/ t) j5 j
  76. char *dmabufdest2 = NULL;: `1 v0 V  A3 D# d+ x
  77. ( F' T1 R, C, u- V9 t
  78. static int acnt = 512;4 {0 x; o8 ^3 h2 _* w
  79. static int bcnt = 8;' s9 b" V1 j$ Y9 h6 X2 W/ j, F
  80. static int ccnt = 8;) f1 E2 K, T+ z+ _- L8 M

  81. 2 p, @6 [% d: y% ^: S$ i9 n/ F
  82. module_param(acnt, int, S_IRUGO);
    , Q& M( q$ @" U( [2 f3 K7 _' t! f
  83. module_param(bcnt, int, S_IRUGO);
    . `% u" W1 E8 l! O) k/ U
  84. module_param(ccnt, int, S_IRUGO);
复制代码

/ f3 ?5 t. D% u6 V% D( F3 L& G# @
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
. H5 K2 v4 t$ z3 O9 jarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
/ z  }- J! Y  b4 \1 C, g7 D     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。! h# p' o( E+ P7 ~

, P9 s7 a& k* C4 M' V4 d' P% ]) ^( x% z
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-7-29 11:19 , Processed in 0.039958 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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