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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
% N+ u- C3 ~% P) K
  1. [code]EDMA sample test application
    7 |$ u1 w# v6 S9 g+ y9 K
  2. /*  |1 }; C0 x3 z
  3. * edma_test.c
    ) P) Z* B7 V7 `4 r% R
  4. *1 p# K8 q* a+ u
  5. * brief  EDMA3 Test Application
    # y7 ~* z8 i8 O7 ?7 T( S
  6. *2 C- r6 p* @, [+ V; g% E) w
  7. *   This file contains EDMA3 Test code.
    6 f( D# I$ k8 c  M9 G: R
  8. *
    8 r' t1 Z/ c' j7 [. T/ m
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    3 {6 h) r: e9 J' X( ?; J& i* @; @) Z6 ~
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    ( ^: f5 B1 t; t/ x6 J1 ?  R- B! ^0 ]
  11. *         TO CHANGE.
    2 ^/ g/ @2 L& r$ x; e
  12. *5 p% l' Y4 [$ {
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    ' o- P1 X8 S: l
  14. *( g+ z/ n* ]$ v
  15. * This program is free software; you can redistribute it and/or8 x( c/ U, E  K+ i0 H
  16. * modify it under the terms of the GNU General Public License as
    " \$ X2 R: V8 J4 [4 D( k5 m# d
  17. * published by the Free Software Foundation version 2.. A' ?' d, {0 G% n: j. s
  18. *) @: S/ b9 i3 w+ \: j' H. j9 o
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    ' i$ G4 j! B% l1 H7 b
  20. * kind, whether express or implied; without even the implied warranty, Z7 ^8 ~. p% |/ W# W. ?+ c( @
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    4 C5 D" n: y% L% Z' c
  22. * GNU General Public License for more details.$ U8 I* k! ~2 p/ R! l2 c
  23. */
    & h+ V0 K0 H7 b: L+ H, J

  24. 1 ]' s) w7 \8 }9 x
  25. #include <linux/module.h>5 D4 m0 x* |  M. _7 w, ]" x& K1 O1 o& T
  26. #include <linux/init.h>
    # M# N  D' p6 d) l- u. Q5 B: p
  27. #include <linux/errno.h>
    1 P1 M& K/ h  J  `7 c
  28. #include <linux/types.h>
    8 r. g, c+ M9 T( A1 c
  29. #include <linux/interrupt.h>7 Y( ]0 l7 ?4 H0 u3 C& y
  30. #include <asm/io.h>
    $ x7 ~' s- P* \% P" D2 ?
  31. #include <linux/moduleparam.h>
    - H- T: l3 G* j
  32. #include <linux/sysctl.h>
    5 n, P% L3 t# Z
  33. #include <linux/mm.h>4 _7 K0 D8 J6 t9 h% Q# \$ f0 \, U# B
  34. #include <linux/dma-mapping.h>
    4 g- k, c/ O9 r& f- L
  35. " G" Z5 H  X: F1 b$ f2 d
  36. #include <mach/memory.h>
    ) U3 ?: r. A/ t; {5 P* M
  37. #include <mach/hardware.h>5 L' {, c5 ?% e: g6 U" D5 _' I
  38. #include <mach/irqs.h>4 ~  I; h& O/ p9 G) k
  39. #include <asm/hardware/edma.h>0 D& f" I" Q0 H# _
  40. ! W" ^0 A3 L+ u" ?) A
  41. #undef EDMA3_DEBUG+ h# L* W: l; ]; ?
  42. /*#define EDMA3_DEBUG*/) I3 F, S; {7 D0 i, A+ \. h3 X8 E4 s

  43. ( [* K7 ]/ Z. }- J9 U9 j
  44. #ifdef EDMA3_DEBUG
    & s4 C4 n4 ]3 a  e& m0 i+ k
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    ) n$ L3 V" d  M
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    9 I( x8 G2 k+ l
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    7 {  A0 |5 N. U2 ^! c
  48. #else
    ' P# V) [8 `3 @) t# ~# B' C. e
  49. #define DMA_PRINTK( x... )4 F1 o% C2 Y; S5 M, L
  50. #define DMA_FN_IN- Z. q) N- {; q* L
  51. #define DMA_FN_OUT1 y% W: y- b# W3 s' ?6 B" W
  52. #endif3 z3 Q5 ]- X  b2 I# n( ~/ ^& A: e
  53. ' W2 o: F. l% d' V, E/ B
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)+ n* |, O/ W7 `
  55. #define STATIC_SHIFT                3
    $ v7 P- ^# a  h3 B
  56. #define TCINTEN_SHIFT               204 l2 a: n! r- Z, N  X3 r
  57. #define ITCINTEN_SHIFT              216 z9 B4 K3 Z1 s) }1 c9 G& u' F; P
  58. #define TCCHEN_SHIFT                22. _( h+ z6 _/ r5 Z
  59. #define ITCCHEN_SHIFT               231 c( \' ~& \& O0 q

  60. & K$ E' e$ X3 h0 ?6 |
  61. static volatile int irqraised1 = 0;
    1 ~7 A# ]0 m  U% u0 q6 |
  62. static volatile int irqraised2 = 0;
    8 j- [& @% J' k( O' t

  63. # G( ^5 W4 ^9 {$ @) b
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    1 ~4 C; Z. F4 v. |
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    , e) A  c8 X( d4 u
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    5 a1 ?0 {4 }  @2 c% b1 g

  67. 7 L" Y+ Y. _3 s5 ]. j
  68. dma_addr_t dmaphyssrc1 = 0;! ?* ~4 ?1 k" ]! |: X! B
  69. dma_addr_t dmaphyssrc2 = 0;
    , F7 _9 s5 a7 b% f
  70. dma_addr_t dmaphysdest1 = 0;3 F* G* T7 E. I: K, r! q1 V0 d
  71. dma_addr_t dmaphysdest2 = 0;
    % K; ~, N! T6 X( t. o! P8 i7 P" \
  72. - o- j6 J; U# T! _/ T
  73. char *dmabufsrc1 = NULL;
    7 P4 {/ A. g6 a# p0 i
  74. char *dmabufsrc2 = NULL;2 E9 E4 n5 _5 M) I
  75. char *dmabufdest1 = NULL;  z% Y+ M: V$ f9 c; b
  76. char *dmabufdest2 = NULL;) ?& i; p: _5 N3 O0 r4 J9 g" n

  77. 6 L6 ^9 u' w* k3 V
  78. static int acnt = 512;
    ( {" O+ \; z0 R# M; H( v; z
  79. static int bcnt = 8;  z9 x, _7 H1 |$ K) ~
  80. static int ccnt = 8;
    ! d3 e* w; V" k+ ~
  81. . V' a' H+ |# e- s
  82. module_param(acnt, int, S_IRUGO);
    ) O- l. Q1 q: V! v( K& q
  83. module_param(bcnt, int, S_IRUGO);' b5 C+ A1 s# r; @' C% E! o' n8 K. t
  84. module_param(ccnt, int, S_IRUGO);
复制代码
  {& L1 _% m* t4 Y9 H' t, s
# N4 @4 k9 j$ V/ Y; p
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
7 n, C# i. P' z. n, j" karm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
7 g  r; |/ y7 R! u% t2 E     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
7 T5 a4 `; \/ K8 {0 A9 l7 B
6 v) g& w. B6 X) e+ z9 t4 K; l9 B3 S* w  S. U6 T- {7 F" ?
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2026-1-1 23:17 , Processed in 0.039509 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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