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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 / x4 a, v* L. i* E, s9 W8 w
  1. [code]EDMA sample test application$ U$ G# Z7 X4 n+ c3 i) ^# m5 v0 M
  2. /*
    6 V; l' K, _6 [) s
  3. * edma_test.c( A3 r7 N( i, r! x
  4. *
    7 h# w( V* V. d
  5. * brief  EDMA3 Test Application, N+ ^( k9 c, f% ~- R
  6. *5 y1 S6 h2 o( y4 l
  7. *   This file contains EDMA3 Test code.. d; c" g4 V# _! N1 P/ a
  8. *
    / @! N, u' t* I6 Q. k% @; h
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE7 Y* y7 |1 o- Q9 P. Q0 d
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT- t. C) D4 E' J% `& N
  11. *         TO CHANGE.; ~+ i% e2 |2 g# v0 _3 {
  12. *
    % g( Z" X# F9 W8 _
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/: v* c+ h1 q9 m6 r  a
  14. *) C: b# _* Q. Q: d. x
  15. * This program is free software; you can redistribute it and/or% N1 H/ a/ k, @7 j* L
  16. * modify it under the terms of the GNU General Public License as: h7 l6 J: t* h) W4 c! N9 q
  17. * published by the Free Software Foundation version 2.
    ! \% p8 \/ x/ e3 b1 y  H  R$ w) R: w
  18. *
    # T  E: r6 G# d
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    + e3 t/ q1 [! ?: u2 S" a; q2 I2 p% ?
  20. * kind, whether express or implied; without even the implied warranty  v' j  N1 P3 D9 L$ `2 ~) R' O
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    ' B! o. X, A; D1 x. x9 d4 s! Q- {% r) |- P
  22. * GNU General Public License for more details.  G4 Y8 d, m9 w! }* H! X
  23. */
    4 @. _: t1 }, P; B
  24. 0 |' ?' Q- e6 ]: H+ |" c# `
  25. #include <linux/module.h>2 w2 c# s2 O! ^# x: D6 n2 Y2 l9 [
  26. #include <linux/init.h>
      f! _' `5 T3 v7 o; e
  27. #include <linux/errno.h>* L1 T* g! ^( H/ m2 I. y
  28. #include <linux/types.h>3 f' P7 l( d7 C0 s# C1 [, Y
  29. #include <linux/interrupt.h>" v( {4 n, T# a8 a
  30. #include <asm/io.h>
    2 S+ {9 E- h8 r& M9 C& N
  31. #include <linux/moduleparam.h>/ M3 [9 X- n  H* o. W$ m/ f. b
  32. #include <linux/sysctl.h>
    * T# |* G' L( {1 ~
  33. #include <linux/mm.h>
    7 a- q0 i) S- r$ l5 W4 H
  34. #include <linux/dma-mapping.h>: B/ Q1 j# c  B2 k0 y) {* a

  35. 7 p5 s' Q  V7 |' G! X  I: M0 e
  36. #include <mach/memory.h>
    $ u' v* g  \& B& E9 _4 G% H1 I/ ]
  37. #include <mach/hardware.h>5 X6 r$ |1 W) ~  J
  38. #include <mach/irqs.h>0 P3 J; p! R. ]) E
  39. #include <asm/hardware/edma.h>/ s0 ~$ b$ l# D! f6 }
  40. - Q! _6 J+ I9 Q
  41. #undef EDMA3_DEBUG
    # m0 _1 X6 u+ Q, h4 B& ?
  42. /*#define EDMA3_DEBUG*/
    , l# E! s3 H4 ?, r' }6 @+ ?
  43. 8 n* S8 J3 ~" T) b
  44. #ifdef EDMA3_DEBUG
    3 \9 R* f, A- _+ F' s/ P
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)( ^; w) W  q0 S4 Z$ N; ~, i7 e) A; ]
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    # A/ [+ h' M4 I6 v. F
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)2 R5 R8 l4 t8 P3 F+ F- V
  48. #else1 ]" O" B  r! p$ p$ \
  49. #define DMA_PRINTK( x... )
    3 k# h/ f3 ?  ^3 }# x
  50. #define DMA_FN_IN# l% L2 y" Z/ P" x: Y) d/ t, g
  51. #define DMA_FN_OUT
    ( I6 v, @7 M+ `# P' H! F
  52. #endif
    ! G' v+ [8 v7 k7 Z
  53. 7 S+ ?5 p0 ?* X' X; r+ U5 B
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    ; D4 D# N0 ~$ `
  55. #define STATIC_SHIFT                3
    . F: U% ]* p& b! O! I2 _* L6 z
  56. #define TCINTEN_SHIFT               20
    - G% E; f  l+ m' X( j# |* H+ w7 G
  57. #define ITCINTEN_SHIFT              21# O) J& |* ]! l4 ^& h6 ]6 {( \. e
  58. #define TCCHEN_SHIFT                22
      {  `; T7 z( [( c" e) R3 G: Y
  59. #define ITCCHEN_SHIFT               236 E& c+ S# @$ v6 Y+ H: y  n
  60. , t% C9 m% b1 |. X6 ]3 H' \
  61. static volatile int irqraised1 = 0;
    0 Y: F  M1 e4 y' c$ s2 c
  62. static volatile int irqraised2 = 0;
    ( F+ f+ C1 n- f; q' M  b

  63. 8 ?) I/ b# J5 h1 `! }& I/ l
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);4 f# _; C: W: ^, ^2 s* z* {/ n" M  a
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ) C- m7 ~5 e0 B/ x( x$ L
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    # c7 F5 e7 }( G" ~, S* C  h2 X
  67. 2 X  Y/ e7 q& D* p* }+ k
  68. dma_addr_t dmaphyssrc1 = 0;
    / v( g* p, L7 A: b- F
  69. dma_addr_t dmaphyssrc2 = 0;
    8 T; }! ?9 q% p5 H# }! S
  70. dma_addr_t dmaphysdest1 = 0;
    4 y' [' ^. o/ A( f* W$ k0 [
  71. dma_addr_t dmaphysdest2 = 0;
    , y# |! A7 f9 @6 a  P; {3 N

  72. 0 G$ }7 x7 P* ]- v! }8 m
  73. char *dmabufsrc1 = NULL;5 @2 e  @9 v: L( z
  74. char *dmabufsrc2 = NULL;
    : @. ~2 C& w$ m9 R* y; l- r$ G
  75. char *dmabufdest1 = NULL;  D! e% }" s4 I+ G$ H) y
  76. char *dmabufdest2 = NULL;
    2 n1 H# @& H2 f, x$ D8 d
  77. ) w2 N6 F$ @5 h" ~
  78. static int acnt = 512;
      z6 U5 F3 z& O  q9 z
  79. static int bcnt = 8;! R! c7 G5 o/ y7 {5 i
  80. static int ccnt = 8;! M+ X0 u& f  X7 f' n3 q/ F

  81. . k4 [5 ~2 `0 {
  82. module_param(acnt, int, S_IRUGO);
      P% Z$ y! f; k4 n$ T5 P
  83. module_param(bcnt, int, S_IRUGO);
    9 ]* [3 d- x- I" r( _( A. U& _' c
  84. module_param(ccnt, int, S_IRUGO);
复制代码
( G/ G  |5 s0 Q% a

5 p1 N* {) m  t$ D  t      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
1 R) Z) t3 H9 s3 aarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。- H9 d% T7 P1 C, U6 P
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
6 ?/ q- n6 |' _" g( ?1 P1 M3 U& u! m1 t  Q% Y* t) e

/ g6 J* z4 C' L* J; u" a
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-1-14 00:16 , Processed in 0.039520 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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