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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 ( @6 [7 e" r* C" s
  1. [code]EDMA sample test application
    . ~" w  q( K$ Q1 ^- @4 k
  2. /*6 N1 `# d2 {5 ~3 Y# L8 u
  3. * edma_test.c3 k! c" W, M8 I; }/ i; m0 g& [
  4. *
    ) V& e% b9 ?" X: `
  5. * brief  EDMA3 Test Application
    ' N2 H/ y+ I9 i. ^  V9 j
  6. *; g' {0 b" i: W+ V/ V4 o
  7. *   This file contains EDMA3 Test code.7 i- h  x9 d7 i3 W; ~
  8. *2 @2 p0 {& C+ U& m
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE1 F- f6 C: H* v# k& |; s/ B' A) b
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    1 [- \9 G; b& _5 v- _: M" J8 p  a7 @
  11. *         TO CHANGE.
    ) X0 R& `/ `9 |0 s9 \
  12. *  Q8 c1 {# _* T8 V( Q; [0 I
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    + s& Y' a* E. [  f& e/ C/ R
  14. *) E9 ]/ o; c. x
  15. * This program is free software; you can redistribute it and/or) C7 _, d# f5 u6 _$ n8 V( ]
  16. * modify it under the terms of the GNU General Public License as# L6 i: j( G8 s9 Q
  17. * published by the Free Software Foundation version 2.
    0 l3 _; g- K$ d- s7 n% x& g
  18. *( q- w& t2 @: c6 u' l) m
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any& [& R# ?4 C5 O
  20. * kind, whether express or implied; without even the implied warranty# }$ f! A% S$ W6 a# |& ]
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the4 v+ X, U$ P5 v# s% A
  22. * GNU General Public License for more details.1 g! ]/ F6 |- h% A
  23. */7 h0 _- D, ]9 m5 A' U( Z
  24. ) S; P' E# }# g1 Q9 Q& @
  25. #include <linux/module.h>
    + v" c0 G/ H) G) A& P) `3 k
  26. #include <linux/init.h>
    : t+ l$ u- k1 W+ I
  27. #include <linux/errno.h>
    ; t3 ?! d8 J; G: t$ w
  28. #include <linux/types.h>. E1 f$ @6 T+ i( O
  29. #include <linux/interrupt.h>2 y" t8 r6 m$ ]
  30. #include <asm/io.h>! X8 s# Y0 T' R+ F3 D) s. @" D, Z
  31. #include <linux/moduleparam.h>
    3 |. o. p0 ~9 U
  32. #include <linux/sysctl.h>
    / R' z' d$ l" N- V$ ?
  33. #include <linux/mm.h>! j: h2 F$ w5 I$ P
  34. #include <linux/dma-mapping.h>
    + N  a( G9 a+ z
  35. 0 P3 H1 d- H' W$ [) s% L* c% u
  36. #include <mach/memory.h>8 s: y8 _2 |  l8 Y) n& z5 r
  37. #include <mach/hardware.h>
    ' H& Y4 ^0 t. B& n+ Y* C
  38. #include <mach/irqs.h>/ h6 Q7 j9 e  m5 ^( L/ X0 r
  39. #include <asm/hardware/edma.h>
    ! w. S4 k& ~8 G; B6 f7 w+ p

  40. 6 G& j+ i# Z; C2 @7 f6 |
  41. #undef EDMA3_DEBUG, V& q4 d6 G) ?; ?# E# T# L) A, A
  42. /*#define EDMA3_DEBUG*/
    # b+ [* q3 G8 F5 \2 w/ W
  43. / W# V( Y- ~' s
  44. #ifdef EDMA3_DEBUG# w. x7 X3 d' A
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    % w7 K6 @" _0 _4 E
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    ! I3 q, ^, d& W# w" m
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    5 }$ }2 ]' L% j. C, `. S5 y9 `% }) A
  48. #else
    ! ^. S' U. q8 L* j, q$ y# Q# i
  49. #define DMA_PRINTK( x... )
    8 C8 v+ K% j& W# b
  50. #define DMA_FN_IN
    1 n) y7 r/ F' l9 {7 e. G
  51. #define DMA_FN_OUT- D# l$ l3 H% `& w2 z/ S
  52. #endif
    $ J) ^  V& {) ~. {

  53. 8 y! n) S. E# C* U' b5 ]9 R/ U
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)1 }3 c6 e6 o: S& N8 B# @6 E
  55. #define STATIC_SHIFT                36 \1 r6 _4 j. {4 ?
  56. #define TCINTEN_SHIFT               20
    4 ?2 h$ W/ B" d7 U' a9 ]  z
  57. #define ITCINTEN_SHIFT              21
    2 R* F2 S" P( W1 g, @" Q" `
  58. #define TCCHEN_SHIFT                22" f& X' e2 t) o
  59. #define ITCCHEN_SHIFT               237 m; e) {! b$ T; N7 R( E+ g

  60. 0 \* t) u+ U! Y
  61. static volatile int irqraised1 = 0;
    2 N1 v4 J& Q9 H& C; o
  62. static volatile int irqraised2 = 0;# n5 U! g: T% U+ c- v
  63. 6 w; m  Z/ R3 U+ C* V6 t; p8 s
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    : C6 s% I1 b0 v/ w+ H
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    3 K* l( c, W% i9 b3 e! x
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    % {# G- S% W; f! ]* {7 m
  67. ' h8 v4 Z& p9 q" C/ p  Z
  68. dma_addr_t dmaphyssrc1 = 0;( P5 }5 U/ F8 q! p0 t
  69. dma_addr_t dmaphyssrc2 = 0;+ {. p3 i4 c$ d, D- L
  70. dma_addr_t dmaphysdest1 = 0;
    ; z; O8 y5 l1 P6 K6 k) Q. `) ~& K! P
  71. dma_addr_t dmaphysdest2 = 0;; }- c9 B% H8 h( ^5 P
  72. 1 K- o% t3 c' b( U+ V: s* p5 D
  73. char *dmabufsrc1 = NULL;  V6 b7 b( i! m
  74. char *dmabufsrc2 = NULL;
      G8 h5 f2 C' i( e! I1 \9 u) m" ^
  75. char *dmabufdest1 = NULL;
    7 f! v. X3 n* U( i
  76. char *dmabufdest2 = NULL;
    . z. U5 @* ?+ ~6 H' ]
  77. 5 C; P* w0 _) W6 q! \
  78. static int acnt = 512;
    - R9 X# W+ I: n. I. O
  79. static int bcnt = 8;$ p6 z3 Z4 [, q) X
  80. static int ccnt = 8;
    9 R3 k" |- m4 y- w& _+ F0 b  v% Q

  81. & @! [4 q8 p  f# j
  82. module_param(acnt, int, S_IRUGO);4 M% G3 x" Q, E; J3 x3 p
  83. module_param(bcnt, int, S_IRUGO);
    2 B8 _3 F$ ^0 ]+ U% P$ k* e, F6 J
  84. module_param(ccnt, int, S_IRUGO);
复制代码
5 R( _, Y; _$ g
/ s  P6 f& P8 ]/ `9 B3 Y
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
. z* X$ }0 |+ X" oarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。0 T. `7 h9 [8 Q. S- g
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
; _9 y5 c( I1 [* ]9 b) d/ m. J' f- l! c5 L( d( O
/ e1 N$ e, i  j: e2 @
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-12-5 16:07 , Processed in 0.039201 second(s), 24 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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