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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
- |# a5 l4 J9 w* `
  1. [code]EDMA sample test application
    * \3 t. V) T% h2 q+ d; j
  2. /*, L# P* b9 _$ k1 S
  3. * edma_test.c5 X" i! j. @! e. Q  b
  4. *5 a" g5 _9 G( W' P/ R5 ^- f6 r
  5. * brief  EDMA3 Test Application
    5 ~& R) G0 P' ]4 Z8 b
  6. *
    7 }" F6 s) x4 R" m  b: v( d% _
  7. *   This file contains EDMA3 Test code.
    7 {4 ?3 m  c" B6 Z) ~
  8. *1 Q  \/ e3 {9 W) B5 t
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE7 d3 s+ x) L; h6 X! c6 f# L
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    % D% J2 I5 V/ ], m0 I
  11. *         TO CHANGE.
    . w7 }3 h% v- E4 W1 L5 d/ q0 |
  12. *" d+ ^: \! i8 N! ?5 w
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    % L, d# b0 R7 U0 y
  14. *
    : P8 @; W2 h" Y
  15. * This program is free software; you can redistribute it and/or
    7 O6 t: {/ k3 Y$ i
  16. * modify it under the terms of the GNU General Public License as
    $ E& a+ [5 [  _5 k
  17. * published by the Free Software Foundation version 2.; K/ s8 a/ k7 [# `
  18. *6 E0 }! \9 \$ U& O
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    / W" w; D6 z' g  r' Z
  20. * kind, whether express or implied; without even the implied warranty
    . F% j4 g0 s' l0 H
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    6 w) d: F7 l5 k  L
  22. * GNU General Public License for more details.5 ?" M- W- _" U& a3 ]
  23. */
    ! t% V+ }4 n. e
  24. 3 |% t. j) {; t  B# n, p
  25. #include <linux/module.h>9 {8 y$ u% I5 p0 s+ ?4 U7 H: C
  26. #include <linux/init.h>
    * B- _  ]- m) M2 @4 b0 W
  27. #include <linux/errno.h>2 q4 P% d/ ]- c1 |$ S  d# y
  28. #include <linux/types.h>
    / ^/ B  Y. s( x. p  s
  29. #include <linux/interrupt.h># r3 p8 ?) M" a* B
  30. #include <asm/io.h>
    2 ?) z% w/ z: c' v- I' I3 N, j
  31. #include <linux/moduleparam.h>
    6 D& j4 U$ i# T0 m9 ]: m
  32. #include <linux/sysctl.h>5 f2 a3 e9 j/ i5 D  z/ U# l
  33. #include <linux/mm.h>
    # S! ^( o9 y. ^, O6 t
  34. #include <linux/dma-mapping.h>. J9 |0 X% `0 Q0 G2 n

  35. ; s: f7 f0 T0 }( I/ T% [
  36. #include <mach/memory.h>
    6 L& _4 g$ t/ `6 S. X
  37. #include <mach/hardware.h>
    - h. O, I  w8 k( w$ x: ~
  38. #include <mach/irqs.h>
    3 I# I/ y* `- E* P1 M
  39. #include <asm/hardware/edma.h>6 x+ F; D$ ~  [. a: V3 ]8 M3 s  p
  40. & G/ P. r  t1 A. N; b+ y. b9 E
  41. #undef EDMA3_DEBUG  s% N, Y/ x& B6 B& Z$ }
  42. /*#define EDMA3_DEBUG*/
    $ N+ h# J. l& ?: I7 F- p

  43. * C3 N. A! }' Q
  44. #ifdef EDMA3_DEBUG" D9 }" a8 @; f1 f
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)4 Q9 V* _4 d7 ~2 B% i+ \% n, W" G
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    + X% m4 Y* m6 m/ G& m4 F+ a  M. q) D, V
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
      l2 W! O, F7 H( D/ D5 I
  48. #else5 @" b, o6 n2 {# t) f! O- F- j
  49. #define DMA_PRINTK( x... )
    . v' Z2 y1 M/ e' E' Q" g6 Q
  50. #define DMA_FN_IN
    5 l" p$ |3 k1 r, f3 Q1 m4 p, e1 G
  51. #define DMA_FN_OUT
    * }) ~7 Y: _3 f/ R, L, S/ a9 b
  52. #endif# ^  ]# c3 H) ^/ n1 F; b. K' b
  53. ' v! }' _* _3 @( [2 I. z" @
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)! i2 |1 m; u6 C9 G8 ~
  55. #define STATIC_SHIFT                39 m4 ^1 |$ R# |$ y% F- b4 [
  56. #define TCINTEN_SHIFT               20/ v4 ~5 I' g5 O  _7 n; p" n- H+ X+ R
  57. #define ITCINTEN_SHIFT              21
    - l: E4 [1 q, j  x
  58. #define TCCHEN_SHIFT                224 D2 R0 ^$ Y. D% O1 G
  59. #define ITCCHEN_SHIFT               23) _& k/ K9 ]7 P# A7 n

  60. & V2 k& X% }: |( y! Q& \! [
  61. static volatile int irqraised1 = 0;
    . d% C3 x' \! v$ M; B% N, ^( E
  62. static volatile int irqraised2 = 0;
    7 }2 [4 ?5 X; c* n' B, y6 x( \
  63. ; W3 o2 L: V6 L% ~/ U+ P  h  c
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);8 i1 Z8 x6 ^& q7 I  J; k
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    3 Q5 q0 v+ G* Q. t* K3 V# I
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ' e; m2 a  s, M, ^3 k
  67. - d3 k9 |, _' M$ Z6 m
  68. dma_addr_t dmaphyssrc1 = 0;
    * p% K+ ^+ h6 _$ y2 O# o
  69. dma_addr_t dmaphyssrc2 = 0;+ e5 d' S& @8 w1 S: u4 h; Z
  70. dma_addr_t dmaphysdest1 = 0;; o; _( D+ F4 _4 \7 Y% R& Z
  71. dma_addr_t dmaphysdest2 = 0;
    2 G% m+ {6 ]+ ~: V* R1 P
  72. * C+ o$ w3 f# }; u
  73. char *dmabufsrc1 = NULL;
    / P9 z7 ]1 d9 U8 m$ X2 j2 t
  74. char *dmabufsrc2 = NULL;
    ; L7 s1 u* x, Z0 \4 V; K3 k
  75. char *dmabufdest1 = NULL;2 j9 A! p( a" u
  76. char *dmabufdest2 = NULL;
    3 U& ^8 R+ \/ K" ^1 l$ p! x

  77. 3 z1 A- F+ i& q/ R! U
  78. static int acnt = 512;
    5 q' w' w* i7 D8 R* G7 Z
  79. static int bcnt = 8;! E% B* V* x: m7 w7 D3 Y
  80. static int ccnt = 8;
    - V* u5 R. D  M

  81. 4 D* w5 B5 Q. F
  82. module_param(acnt, int, S_IRUGO);
    ( i! h5 @) @  x! [  d1 l
  83. module_param(bcnt, int, S_IRUGO);
      C. F* s. c4 w$ t' j3 G, ^
  84. module_param(ccnt, int, S_IRUGO);
复制代码
! |8 ~6 a/ p- D: t8 w
! _2 q/ u& W  a! `3 h2 K
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用3 J5 ~* Y4 |* `, ^5 o7 A/ ^) s
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。2 H: F: Y- O3 h' X+ l
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
0 W( g0 p4 D3 R( S9 j$ l7 v' d% Q2 v9 M) a" q, d
0 E, n" b3 U/ Q, B: E# z$ @( o) f
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-7-2 16:29 , Processed in 0.044915 second(s), 28 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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