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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
4 W# T) o# G) p7 i7 x& a/ X; B
  1. [code]EDMA sample test application
    " d: m: `. n6 G2 G' w
  2. /*
      u3 `9 K; C: m8 \
  3. * edma_test.c
    ' S; F  ]4 `' L, I
  4. *. w/ R; i6 l$ P
  5. * brief  EDMA3 Test Application
    % U3 B( K( J0 X, E7 l) a& i2 S0 D
  6. *) n6 _4 a  g+ w2 h  y
  7. *   This file contains EDMA3 Test code., s: O$ T8 B0 n6 R
  8. *5 L0 _- y4 w' [6 q* W1 J: d, m; d
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE/ S5 M% I# K! ?& m: @  V# m" t
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT/ k! u6 v6 D8 t" x2 P
  11. *         TO CHANGE.
    % m# F1 n$ u0 c' T/ p; P
  12. *; Y5 z& G8 ~8 m- ^* y' ~5 n( a% }
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    3 J6 W0 W3 O- G9 W: s- F
  14. *0 Z7 P. S: G6 K+ t7 b
  15. * This program is free software; you can redistribute it and/or
    ( Y2 g& |, `5 K
  16. * modify it under the terms of the GNU General Public License as
    2 @! ?; m; j  [3 ~
  17. * published by the Free Software Foundation version 2.. F5 L0 o. V. f, z8 z: ?
  18. *7 {; `0 f" @/ `5 z% Z" R& G; `. `
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any6 B3 [# C: r, F5 H- x5 o9 r
  20. * kind, whether express or implied; without even the implied warranty
    + d1 u0 ^, l3 g. @
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    2 o( y* ?) w: t( S( K3 s: N7 \, ^
  22. * GNU General Public License for more details.
    6 |: r) `7 K8 b3 Z
  23. */
    * f. I# o2 e% p& @- S

  24. 4 q* V) w, m. U6 V& `+ n
  25. #include <linux/module.h>
    + A4 k7 j  |  F* A: c( f
  26. #include <linux/init.h>
    2 q+ {, M8 l% M7 ?. ~0 y
  27. #include <linux/errno.h>. M: g8 g# N5 B! V& n# ]
  28. #include <linux/types.h>/ ]" g, X# k8 t0 d5 `& ]
  29. #include <linux/interrupt.h>3 G! ?% E6 H& ]* U3 @- y
  30. #include <asm/io.h>6 t8 ?9 D% n4 B. b2 i3 `6 N9 @$ \  M
  31. #include <linux/moduleparam.h>
    ! R8 G% U4 S; \
  32. #include <linux/sysctl.h>2 @2 e  D/ M  K4 F- B
  33. #include <linux/mm.h>
    7 m) x0 [6 U" L' x0 G% z' Z; L
  34. #include <linux/dma-mapping.h>. k+ V! y8 N& J* I; c% b
  35. : ?" J! F/ w" w! v
  36. #include <mach/memory.h>* M  U2 {$ j5 A) ]* r
  37. #include <mach/hardware.h>) ~1 N1 {2 N7 H) B
  38. #include <mach/irqs.h>* H* K* k  w/ [! k$ c( @% V
  39. #include <asm/hardware/edma.h>
    ; f8 M3 C6 X2 m4 A, L7 k3 _  v

  40. 8 Q; P  c+ \6 Q
  41. #undef EDMA3_DEBUG# g: ?8 S, y1 S3 i1 H; Z
  42. /*#define EDMA3_DEBUG*/: K: ~) G& l: Q$ X
  43. - m4 \( Z( H% z7 u
  44. #ifdef EDMA3_DEBUG
    + W8 R8 P! ]1 h8 a' [
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)( x0 e+ x; j9 D
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)% x! ?& I  Z  e, q, g1 b
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)& Q2 p1 e+ h) T$ P+ v
  48. #else4 A3 b7 l- e" g  {
  49. #define DMA_PRINTK( x... )
    7 D8 P# I: G. {: @9 m4 C
  50. #define DMA_FN_IN
    % W$ b( g* F3 T" z: q
  51. #define DMA_FN_OUT
    ' k/ q- z5 M+ ~, ]* U
  52. #endif; Z- j" x" O( [8 m- Q6 p4 m' e1 ?
  53. ! f1 I& R% e( x6 N
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)% l1 r' [9 l8 A) [6 N! e/ f
  55. #define STATIC_SHIFT                3. z4 l. f, [* K& G
  56. #define TCINTEN_SHIFT               20. u6 w) b/ C* L2 H9 G
  57. #define ITCINTEN_SHIFT              21% d* C. Q( y# S  N9 q5 {3 ~0 v
  58. #define TCCHEN_SHIFT                22' F3 N$ e0 |( ?2 Z* c5 i6 v
  59. #define ITCCHEN_SHIFT               23" ~/ Z8 b# G* C, L) K
  60. 0 N2 ~1 l$ q0 W
  61. static volatile int irqraised1 = 0;
    ( n3 |7 K( _0 V* I: n
  62. static volatile int irqraised2 = 0;
    2 |% H7 X: Q/ W: L0 J
  63. 2 }8 A' X& ?  H$ P; o2 k1 U
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);' h; O* R- g1 Q$ ]% q/ `
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);( Z9 ^* ^1 l( H
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);; e3 E9 \, H. F4 I' s

  67. # L( L; y" K6 N- ^% Y
  68. dma_addr_t dmaphyssrc1 = 0;0 q0 U; C# `" @9 p3 e+ @* Z$ e
  69. dma_addr_t dmaphyssrc2 = 0;3 O* g' O7 X6 w" q7 _
  70. dma_addr_t dmaphysdest1 = 0;
    " d+ ^& t9 |+ I) y
  71. dma_addr_t dmaphysdest2 = 0;1 r  P7 l5 C' P& h0 u& \0 p
  72. 0 n& s, }9 ~0 w6 H
  73. char *dmabufsrc1 = NULL;
    4 c- ^: y, _* S: G
  74. char *dmabufsrc2 = NULL;
    % K6 M: l2 R! ^2 e4 n8 B8 V
  75. char *dmabufdest1 = NULL;
    - Z, p$ G5 q7 W0 p1 ~- i
  76. char *dmabufdest2 = NULL;7 T1 o9 E( c5 y+ X+ U
  77. $ D, i) z' }) X, U6 ~: Y
  78. static int acnt = 512;
    1 q" v8 S% P) i2 |* e% @  _; t) M
  79. static int bcnt = 8;8 m. e" s5 V3 l
  80. static int ccnt = 8;9 o$ k4 j+ i4 o0 h* Q! F9 [) F

  81. 4 w7 \4 f" S4 W3 M( D2 p8 z2 b/ L
  82. module_param(acnt, int, S_IRUGO);
    0 R/ Q, ~( Z4 Q  d! p
  83. module_param(bcnt, int, S_IRUGO);
    0 N) n" y. C1 Y) h8 h  m! [: a
  84. module_param(ccnt, int, S_IRUGO);
复制代码
* d8 h6 ^6 {' P; f  O" f
0 V5 X* s" E' ?7 n! @
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
8 k1 m4 E6 n: M) Barm-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 v4 z3 l. x+ S. r
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。* v! R. l. s0 r) o6 t5 V  o# R  S5 n( [6 [

5 r* v7 a1 H( M
2 X5 t% A+ Y; K0 r' f$ p. Y& R
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-8-14 18:45 , Processed in 0.040527 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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