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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 % @' l' g: f+ Y* K) e
  1. [code]EDMA sample test application
    * \# J) |9 y! D+ }& d, K
  2. /*
    " }. M3 ~! d0 n% N3 c6 s4 D
  3. * edma_test.c
    . g. i- f' }, j3 Y
  4. *# S- s. h6 E, v! g- C3 b
  5. * brief  EDMA3 Test Application
    2 a& s4 V2 C7 N/ {
  6. *' t# s) b9 C1 d; m! z, M
  7. *   This file contains EDMA3 Test code.. t# t# ?& z. m6 @
  8. *  j) w* Q, \2 [, E
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    - A1 r" U% H: v' G  x6 r- c
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT! D) s0 \# N6 r/ p& j2 D! J9 U
  11. *         TO CHANGE.0 }3 y1 W1 `/ T4 v
  12. *- P: `4 F3 q* {
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/0 C& ^: j4 |4 [% F" g" l( X
  14. *
    + p8 t  A- t8 m. s  o" ~3 w' _3 s; u
  15. * This program is free software; you can redistribute it and/or
    ' C- O5 |3 R6 ?4 P/ P# M
  16. * modify it under the terms of the GNU General Public License as, m  m, c: O$ k
  17. * published by the Free Software Foundation version 2.
    5 K- L' n1 ]: R) Q
  18. *: X2 k& W) u" a3 \# k
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    2 }( |9 w8 u8 H( \
  20. * kind, whether express or implied; without even the implied warranty& i% H% ~* ~" r8 Q( d' B
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    " P0 G- N3 A0 S' f# K
  22. * GNU General Public License for more details.
    7 }5 p# D9 p' Y( q# J6 ^
  23. */, M# W# @$ y/ a7 {
  24. 4 C0 e$ m; J8 w  k9 ?/ |4 _: N
  25. #include <linux/module.h>2 z# }7 A9 _0 r: q3 K1 D$ J" ?3 @
  26. #include <linux/init.h>$ J! x. p/ K) o. O( }- v' e
  27. #include <linux/errno.h>
    % t) d+ y. X3 q" w' L
  28. #include <linux/types.h>
    7 W5 B* S  u5 R! Y7 d# J
  29. #include <linux/interrupt.h>" h) S, t6 R5 p, }: L* z$ \8 [
  30. #include <asm/io.h>
    : x! p8 H' B0 k  u
  31. #include <linux/moduleparam.h>7 t. J+ v1 V" t5 n$ C
  32. #include <linux/sysctl.h>9 r/ N) z: e: ~; F5 g5 G
  33. #include <linux/mm.h>6 e9 ^% Q/ }- q$ j
  34. #include <linux/dma-mapping.h>2 b9 ]4 Q7 a6 y- G* u* g

  35. * u4 `% u3 V! V7 W& [
  36. #include <mach/memory.h>. r& F" I5 G* [" d% V3 A
  37. #include <mach/hardware.h>
    ( k! I% P4 h6 i/ \& s% d  P
  38. #include <mach/irqs.h>  `" B: \1 p! X5 u
  39. #include <asm/hardware/edma.h>0 t0 d1 e9 R( \- R" t+ Z: h
  40. * s# E) G5 v! K0 k
  41. #undef EDMA3_DEBUG) F7 C' v7 S2 y! O
  42. /*#define EDMA3_DEBUG*/
    , e9 q% m- L* D, p

  43. ! r& {( a, ?* X1 ~: `. o
  44. #ifdef EDMA3_DEBUG7 Y( c) H  g& l
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    2 e: `" o7 B2 ^) T1 n1 H' u
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)5 a& ^+ N& w$ t: C$ }
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)- e& `1 C) x$ F/ p# O
  48. #else
    $ J' M9 t+ ^5 d  b4 A% n7 l: g) O
  49. #define DMA_PRINTK( x... )
    ( f. ^5 r& a; g. P
  50. #define DMA_FN_IN
    & S+ d- s3 W  I5 T& e4 a8 I
  51. #define DMA_FN_OUT
    ' v" v* D8 x( f: g$ A8 j( Q* a
  52. #endif$ ~0 o1 S* m2 ?

  53. & {+ }5 ]9 ~% V4 n
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    + i0 K$ Z8 F. \
  55. #define STATIC_SHIFT                3" D: x" H9 B! |1 l  _  w
  56. #define TCINTEN_SHIFT               20- c2 P  U, u" W0 `! H
  57. #define ITCINTEN_SHIFT              21- ?$ V+ J1 n# S2 C. Z1 O
  58. #define TCCHEN_SHIFT                22& y  n6 h! y- s& C3 a9 c( K: h/ h
  59. #define ITCCHEN_SHIFT               23
    # ~8 o4 @+ g& Q+ N9 f5 O

  60. : K. S" ?% d( J0 ?5 D
  61. static volatile int irqraised1 = 0;
    2 B- d) P1 V; Q/ _; a# p
  62. static volatile int irqraised2 = 0;' A, G2 @) L; O6 y$ f. b. I: u/ p
  63. * k1 B; _7 S" X2 q+ F7 u  u0 p- J
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ! H" S: Q/ J2 d2 C$ n$ R7 C
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
      ^% i; u2 [% B/ z
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);; V9 ~% f5 B' g+ L/ D

  67. 8 _( b# T! c# N
  68. dma_addr_t dmaphyssrc1 = 0;$ o% O* @! U; F: J
  69. dma_addr_t dmaphyssrc2 = 0;: l! i1 o7 ^. a' }5 G) I
  70. dma_addr_t dmaphysdest1 = 0;, t* ]8 x3 @: J
  71. dma_addr_t dmaphysdest2 = 0;% X: N- J1 ~: c# T2 d4 @
  72. . A' ?- G5 W( C" B% D0 h2 ^
  73. char *dmabufsrc1 = NULL;
    & x$ ~. l. G5 n' _+ D; j1 h
  74. char *dmabufsrc2 = NULL;
    / ]7 ~4 }# F% O% x2 F0 Z
  75. char *dmabufdest1 = NULL;' A" T) f$ o1 _/ A% B
  76. char *dmabufdest2 = NULL;+ w. B; B2 V4 d# C$ b2 M

  77. ; V- Y% ?. m' ~7 \, f1 k
  78. static int acnt = 512;
    # h. R: a4 h% A' a1 L
  79. static int bcnt = 8;) U/ {: l5 ]$ b, b8 Y/ h
  80. static int ccnt = 8;
    9 H0 Y: ~, z/ n* Q9 ~; m4 w" J) \/ E
  81. ; \* s5 {, P% g) o* ^6 ~
  82. module_param(acnt, int, S_IRUGO);, }3 j/ p; @" D
  83. module_param(bcnt, int, S_IRUGO);9 S: Q' ~) c! A% {2 \  E/ h6 {
  84. module_param(ccnt, int, S_IRUGO);
复制代码
3 V4 L* V: B3 b1 M4 o+ Q% }2 z

4 p1 J4 h* g$ y' D/ S2 Q6 c6 h) C      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用' @# a% j% @" u( O- |% V
arm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
3 `' g, j- F' e     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
2 L: E/ x* z, P
5 d8 d. V: U( F/ o( M# R* s3 c/ W' y5 ]; H: G
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-2-21 02:52 , Processed in 0.039178 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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