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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 & c3 W" M: V6 I" o( p
  1. [code]EDMA sample test application3 h* P  S$ K" L' B0 \; F0 |. d
  2. /*4 h: x, L$ H! y  Z& b( ^. B* {
  3. * edma_test.c
    ' _7 V1 w4 S5 Y0 i7 O* u
  4. *
    5 ~2 @, B) A" n7 [
  5. * brief  EDMA3 Test Application
    9 y. z& [% h3 b9 W( c
  6. *) V% n" x  I. s* a
  7. *   This file contains EDMA3 Test code.
    1 C1 d+ m; f) @( C
  8. *
    9 z  O. ]/ C2 L7 X: r3 P1 e
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE& i( y/ h  t/ \0 C1 K
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT8 L$ Q. b) L6 t& L  Y2 E
  11. *         TO CHANGE.* t& \; N* R$ U4 e; ]
  12. *$ k- n5 R2 j* X- O
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/0 @, n+ C2 {" b3 m5 T
  14. *, X4 j) Q5 U  O6 U3 P* e
  15. * This program is free software; you can redistribute it and/or
    2 m; K# l) |" O; D* ?5 `" b
  16. * modify it under the terms of the GNU General Public License as2 e( H7 F. W- z* Q! \0 k6 u
  17. * published by the Free Software Foundation version 2.
    % B. l* u9 {; _4 E1 @1 V2 ~9 Z
  18. *9 q3 Q6 m! k! a/ I4 S( g, o( Q+ s
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    " e' W2 F, U1 }9 w
  20. * kind, whether express or implied; without even the implied warranty) \, {2 F: b5 C  f0 H
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    ( `+ l) x/ l, e( N: d/ q
  22. * GNU General Public License for more details.
    3 y4 R/ x7 I! E! Z0 N0 F3 o
  23. */
    0 R* z5 `# g& v# Z; H0 e9 f
  24. ; S) m) k3 A  n" t! n* w1 w' {
  25. #include <linux/module.h>( T7 e, Z5 f, V
  26. #include <linux/init.h>
    5 R2 n1 c/ u7 I
  27. #include <linux/errno.h>5 r" w) c3 q3 \2 U/ f, D
  28. #include <linux/types.h>
    $ S# s) {$ I- y# c9 A$ e5 r
  29. #include <linux/interrupt.h>/ F* D0 e: ]3 Z1 x/ ]0 L
  30. #include <asm/io.h>
    0 d2 h9 O  L& o) l  X
  31. #include <linux/moduleparam.h>
    1 W7 E+ L- C/ s" R% R' F
  32. #include <linux/sysctl.h>
    3 W/ t6 H9 }9 Z
  33. #include <linux/mm.h>
    . K9 s& ~* E- u' ~
  34. #include <linux/dma-mapping.h>0 o, h) d, h% ^+ V1 Z: C% J
  35. : n3 H" b( ]6 Q& w' D0 N
  36. #include <mach/memory.h>8 v  P* l& r1 W& [' e- H, ]# H6 J
  37. #include <mach/hardware.h>1 F- I# h# S1 Y6 J
  38. #include <mach/irqs.h>9 j: U/ X! N5 g; @4 c; O$ e. G
  39. #include <asm/hardware/edma.h>
    ( j3 O  F: m# W9 k9 Y

  40. 3 R5 l/ _; Z, ?$ |5 O
  41. #undef EDMA3_DEBUG
    ) ^6 ?3 U( F9 j
  42. /*#define EDMA3_DEBUG*/
    9 ~7 @: c$ Q+ D5 F0 u0 ?
  43. ( u0 O7 S7 i9 c8 t+ o! h, G
  44. #ifdef EDMA3_DEBUG( K& I0 h0 }3 L( T* {, f/ s5 p
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    ( v! t# s2 K, S8 Q. E& ?
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    ; t. K) e* H) J8 p  t+ O3 |
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    / G/ z' h5 v$ r+ c
  48. #else* h2 {/ Q4 Q- C* A- o; C5 K9 Q
  49. #define DMA_PRINTK( x... )% x% O1 |! C5 A; H
  50. #define DMA_FN_IN
    2 i$ \2 I4 v7 O5 S& X" T3 ?
  51. #define DMA_FN_OUT( Q% B$ K+ q7 a  Z7 h
  52. #endif
    , P9 L- S1 X' \9 B, m( o

  53. " P# H$ j' N+ z, F& X7 @: t
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    * b6 b+ y, X5 n% {$ s+ n  t
  55. #define STATIC_SHIFT                3
    & l, X# G- F: G2 y& V- c3 T$ W
  56. #define TCINTEN_SHIFT               20
    3 h* X' u5 P  S
  57. #define ITCINTEN_SHIFT              21+ m- M4 _& H( w
  58. #define TCCHEN_SHIFT                22* b. ?; J, c4 |5 R7 E/ W
  59. #define ITCCHEN_SHIFT               23; _" K% R0 b: C

  60. + k0 f8 I9 R5 {4 i/ z
  61. static volatile int irqraised1 = 0;4 [2 s( E. C' x, N$ j6 C
  62. static volatile int irqraised2 = 0;
    0 U( p9 g: d+ _& @1 t
  63. ( J. X4 W8 N% e% u; _! p* A
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);8 `/ A# A5 ]; M. b- R
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);" n% f, P: e: N6 ]$ K
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    / j9 x& P7 `8 X# b: V+ m
  67. * I% y6 f# [* Y* k
  68. dma_addr_t dmaphyssrc1 = 0;' B/ B/ l) D7 V
  69. dma_addr_t dmaphyssrc2 = 0;
    % b# G# O+ e4 N2 V! ^+ l4 d4 D
  70. dma_addr_t dmaphysdest1 = 0;
    ! A8 j# l+ N8 |
  71. dma_addr_t dmaphysdest2 = 0;: g' J: L: K) U) P3 J

  72. , Q1 G/ l' K5 ?/ C0 X5 v0 v& [
  73. char *dmabufsrc1 = NULL;
    5 M9 f( k9 U2 ^% H6 m* Z
  74. char *dmabufsrc2 = NULL;
    # Y. v! v/ ?' r' `! C
  75. char *dmabufdest1 = NULL;; N+ Z. r$ o* {/ E7 u8 Q- K' M
  76. char *dmabufdest2 = NULL;* Y8 O7 Q' j0 a# y- s2 L8 ]7 V$ G

  77. / H: S% A) A: q' Q( w
  78. static int acnt = 512;
    ! {& U3 o; Y$ h4 k
  79. static int bcnt = 8;
    ) }5 ?. g2 T1 _% Z
  80. static int ccnt = 8;
    , ^( C, j) l) o

  81. / d% z5 \3 T' y- J5 ?$ F
  82. module_param(acnt, int, S_IRUGO);7 g+ D, S) x# g
  83. module_param(bcnt, int, S_IRUGO);4 |" `6 S! C3 g8 i( h
  84. module_param(ccnt, int, S_IRUGO);
复制代码

$ {1 P4 W9 h$ F4 X
. D5 Z0 S8 {% S5 N6 p; y      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
* ]% A  U& c( A3 u6 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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
1 z1 g3 g. B7 b4 i     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。* I) E1 l& Z7 F8 Q# o
8 Y3 ^9 J  u0 X9 H

* J) z6 Q/ p9 h- n: R% E
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-6-10 04:21 , Processed in 0.042468 second(s), 28 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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