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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
% O. h! Y3 t3 @4 w) A; V, g" d
  1. [code]EDMA sample test application2 i/ E" h5 `2 c# u, ]- L/ Q
  2. /*
    ; h1 E: q0 i5 z
  3. * edma_test.c& M. U/ G1 r/ d7 @2 \
  4. *
    / Z, C! {& Q9 p3 e2 @
  5. * brief  EDMA3 Test Application
    7 H% z; ]. T; ]8 v3 F& v! {1 ^
  6. *
    ) k, k; E* C3 y! a, v" N3 K
  7. *   This file contains EDMA3 Test code./ ]) ?# l0 z: q  A+ u& R( }
  8. *
    . u% Q+ p' n+ C1 T) ~
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE1 h* g3 E5 X$ e( m/ }! ?
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT" v) f9 f- Z$ B7 l& _' L
  11. *         TO CHANGE.
    ' b8 D4 G. R# @0 ]4 t
  12. *
    " I  K1 |& D8 R+ B8 t; I
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/' X$ m3 `: b* C  C. C2 J
  14. *7 a- }7 Z/ Z3 Y) O8 f
  15. * This program is free software; you can redistribute it and/or
    7 ~# G% ~! v7 t& s$ p8 {7 I( x
  16. * modify it under the terms of the GNU General Public License as" _5 I+ N9 a  a. t2 n( ~
  17. * published by the Free Software Foundation version 2.
    0 ^1 K4 p. ]; h# H0 b3 [# p) V
  18. *( z3 ?* p2 z: O2 V, P/ u0 p8 o$ L8 L
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any3 }! u9 u- Z0 Z4 K& J& k
  20. * kind, whether express or implied; without even the implied warranty6 s6 R& }# P3 A
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the5 ~6 z! U9 l( T7 u# U0 M! P/ d
  22. * GNU General Public License for more details.
      U% e3 y( G" c9 c! D9 G+ b- }
  23. */
    , C9 T: X0 s+ l; U3 }. r* P

  24. 8 `/ t6 _9 T" ]# a
  25. #include <linux/module.h>8 ~1 n& {, ?: \$ |  ^2 A; K9 f
  26. #include <linux/init.h>9 k$ h7 A9 N6 Z: [4 {* R) Y
  27. #include <linux/errno.h>
    / F. B  e+ h# c1 X7 Y! c  }  [
  28. #include <linux/types.h>- Q/ r5 i3 I3 C; G
  29. #include <linux/interrupt.h>
    9 n) N' E) p! f) h, [
  30. #include <asm/io.h>( O1 A  r8 |4 G6 [- O
  31. #include <linux/moduleparam.h>
    * T# @( ]3 r+ M
  32. #include <linux/sysctl.h>
    2 W4 ^' `7 u! c; `: p2 ?& R
  33. #include <linux/mm.h>
    , C9 O7 T+ a7 Q7 i+ t. D
  34. #include <linux/dma-mapping.h>
    / V! r7 S' l0 p2 f- w

  35. ! k; M! _  L$ w" k0 ^  W
  36. #include <mach/memory.h>
    ' G- M9 M5 q5 _% m! ]- H: t& Y
  37. #include <mach/hardware.h>
      N4 f0 X* Z8 Z8 U
  38. #include <mach/irqs.h>5 P( q, |* r3 S* R. r+ ?2 o9 o. J% F
  39. #include <asm/hardware/edma.h>: j6 m2 T0 o3 v) m2 `& G+ Q
  40. 7 I) g/ K2 ^* ~" g& ~" b% j+ ^  G
  41. #undef EDMA3_DEBUG# v! {/ C7 q, a4 C' c
  42. /*#define EDMA3_DEBUG*/7 `3 n/ x  k" S6 u  H
  43. ! n$ ^$ o# g+ \( |* @3 o
  44. #ifdef EDMA3_DEBUG
    . Y& Q3 D# |) w8 i# V. L0 @. e* h
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    : E; w% P3 G2 @4 h
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    2 E+ h8 J& z/ e
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__). ^" K3 Y3 |3 p3 V. R+ Z+ o( {
  48. #else
    # R6 ?* Z& H3 E
  49. #define DMA_PRINTK( x... )4 U* A/ x  t% ?7 q: s
  50. #define DMA_FN_IN" V7 ?1 f: ]2 M/ Z, n
  51. #define DMA_FN_OUT, K8 E. F& V- N$ G
  52. #endif
    3 w2 Z# \" a1 x# q* m. ?6 f. `

  53. , s% N; ?" t. T9 x& h
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    ! W% |" X+ r3 W1 U  R/ f
  55. #define STATIC_SHIFT                36 D+ m. t# `  l# c. \/ \
  56. #define TCINTEN_SHIFT               20( a; L1 m7 @2 b' ~
  57. #define ITCINTEN_SHIFT              21
    8 W6 E2 E" T* ]2 ]- `% f/ z
  58. #define TCCHEN_SHIFT                22
    + F( u# K6 u. }1 h3 P% u' S8 Z
  59. #define ITCCHEN_SHIFT               23
    1 U$ v% B, Q: Y- E$ \4 e- e

  60. 3 y; j) ?$ p, f
  61. static volatile int irqraised1 = 0;
    % I$ X5 W) r" p4 M
  62. static volatile int irqraised2 = 0;1 O9 I% h, n* A3 u6 O& l

  63. : y" U" P) `* J  W2 I
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    8 M) y5 U" e+ ~1 F5 T% \
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);/ k. k  P6 `$ v# e2 C9 [1 z/ r1 Y
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);& b2 e6 l. ~2 P3 C1 h

  67. : [& Q7 @4 U8 L+ X/ E3 G
  68. dma_addr_t dmaphyssrc1 = 0;1 @1 A/ h7 Q, e$ u* G1 O
  69. dma_addr_t dmaphyssrc2 = 0;' S: @# W% |: x9 _2 A
  70. dma_addr_t dmaphysdest1 = 0;# P& N$ M) k' h* s
  71. dma_addr_t dmaphysdest2 = 0;& Q, `6 Y; o3 V- e/ T' l3 u

  72.   X. q1 M, q8 C+ X+ F- _
  73. char *dmabufsrc1 = NULL;
    1 h; X, G# f$ \3 H5 q' a+ l
  74. char *dmabufsrc2 = NULL;
    ( {) z, ~, }2 i. W
  75. char *dmabufdest1 = NULL;
    5 g* j! X) k; k  _
  76. char *dmabufdest2 = NULL;
    / R/ H/ w2 }' }8 K2 }5 f

  77. 3 G0 L1 A  K- H6 X
  78. static int acnt = 512;. j  r& ~* R3 h1 k6 d
  79. static int bcnt = 8;& o0 x5 e9 `% ]
  80. static int ccnt = 8;: D! U7 P5 ^7 V; J: Q

  81. - I$ x! k* U- _) C5 ?  x2 C
  82. module_param(acnt, int, S_IRUGO);  ~7 x  y* A: t7 P5 _/ z
  83. module_param(bcnt, int, S_IRUGO);) N2 {( r% f$ k# \
  84. module_param(ccnt, int, S_IRUGO);
复制代码

  B1 |  j5 B+ w7 Z8 P7 {. A+ u- l4 U# W. s; w, N
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
( k5 x# y5 Q0 X) C9 @+ |0 {7 _8 Z3 sarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
. A, |+ G% W' n5 e  `9 W& L     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
* `5 l$ Z# Y# P  r( _' m! ~3 f$ Z! g4 D6 V8 a& W/ u. z6 r! X. E

( ]& ~* U  K: R+ s8 Y
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-12-7 15:51 , Processed in 0.037813 second(s), 24 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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