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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |正序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 ! x1 g) h0 l0 R8 s( G
  1. [code]EDMA sample test application
    3 i3 O# }4 r  c% ]/ i
  2. /*
    9 w: w/ X& S$ K$ m6 B* J- b6 e
  3. * edma_test.c# Y2 E4 Q; G- ?6 X. S. T3 d  q4 d
  4. *
    0 }" f; K$ z( g+ n, i5 I
  5. * brief  EDMA3 Test Application
    ; L9 z/ W" j3 l, h' v
  6. *2 g( O% g& s% {3 F. h
  7. *   This file contains EDMA3 Test code.3 M, g& X8 B1 i$ S
  8. *
    : E, w" i1 ]1 X- R. l6 z
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE  h1 w% M7 B: \5 a' w* C+ s  T
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT8 ^2 n  j% H& d) s3 z8 I
  11. *         TO CHANGE.
    ( D% N2 i/ D. s
  12. *
    & X, r2 ], v7 f1 {) H+ j
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/  g/ q5 z2 X* T$ U) L! I3 c
  14. *. F# }7 b( G2 y6 ~
  15. * This program is free software; you can redistribute it and/or
    + \4 W. l+ V/ D4 R" d' Q
  16. * modify it under the terms of the GNU General Public License as
    " F7 b0 y8 x( @9 B  M, m
  17. * published by the Free Software Foundation version 2.
    / n8 |% m8 ^  v! k9 ?
  18. */ [  q1 x# b/ I* I4 @
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    1 n0 o& K6 c" M0 W' q
  20. * kind, whether express or implied; without even the implied warranty1 `* d5 }  q! R( d
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    2 n. ?* P  M4 x6 t& n
  22. * GNU General Public License for more details.' _! E% v$ D+ I
  23. */
    # O% `# x# [! G, ^# ^6 d
  24. * M# `3 x8 q% r% X' r  D
  25. #include <linux/module.h>
    * i4 G+ m& d: X
  26. #include <linux/init.h>
    ) l  Q; ~: `, G5 b, I4 |6 x; K- t
  27. #include <linux/errno.h>! l/ Z/ z! a. |/ f* ^( G) }
  28. #include <linux/types.h>
    & N, i3 [/ x  y: |
  29. #include <linux/interrupt.h>
    $ U; h2 r9 x3 ~) M% W" k- F+ W/ N
  30. #include <asm/io.h>; A1 m' B0 r# n' `% Y9 G
  31. #include <linux/moduleparam.h>. C2 {4 D! G3 L/ m) X
  32. #include <linux/sysctl.h>* r3 S' f0 _' p/ H# T5 U
  33. #include <linux/mm.h>
    " E% B$ b0 O, C, A, j' T2 p! S
  34. #include <linux/dma-mapping.h>0 z$ ^1 r  d* E' Q( Q! m, p- ~! @

  35. # m- r5 \$ U" p9 |# }
  36. #include <mach/memory.h>
    5 Y) n& Z+ K! k! {( M
  37. #include <mach/hardware.h>
    ! k- i' {4 E4 a3 @2 D
  38. #include <mach/irqs.h>! F" H# g( K7 ?: e$ }
  39. #include <asm/hardware/edma.h>
    + F2 H3 @* i+ `' c9 _  W

  40. 9 v" J$ D# m) I
  41. #undef EDMA3_DEBUG/ L/ p+ ]8 N3 r* Z) w  M/ X- j
  42. /*#define EDMA3_DEBUG*// S) Y4 ?+ i* \

  43. 0 g) Y& I0 l3 F2 o) [9 [
  44. #ifdef EDMA3_DEBUG, J" u6 t. _* F. [
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
      E/ T) e) X4 Y; N$ {5 c" @
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    * s6 b& p2 b/ U% c5 ^2 n
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__): s) p1 P9 a+ r, a
  48. #else
    5 j9 d3 T8 A) ~. C% v6 E
  49. #define DMA_PRINTK( x... )
    + X+ i0 \$ C$ e  R
  50. #define DMA_FN_IN
    ' ~; C. O- _& C- p7 {! n) H0 @
  51. #define DMA_FN_OUT9 Y4 q* G0 l: n$ C5 [6 Y5 j2 W
  52. #endif6 y8 H7 X; b  q5 V
  53. 8 K0 R- c- j4 X8 \) u4 e0 v
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)) b4 J0 H( f4 I; O6 O
  55. #define STATIC_SHIFT                3
    : P- F6 o9 S/ C# j$ t# b) J5 i
  56. #define TCINTEN_SHIFT               200 W& q/ c0 V5 D2 A" r
  57. #define ITCINTEN_SHIFT              21+ x5 [' {& i3 e: z  r6 j
  58. #define TCCHEN_SHIFT                22
    # f8 n5 Q+ a: F' O) Q
  59. #define ITCCHEN_SHIFT               239 [- ?% E2 N- T5 g; H, F
  60. * j' ^" V( s! c. e( D/ i
  61. static volatile int irqraised1 = 0;2 v+ j+ q) n" i% Z- ~
  62. static volatile int irqraised2 = 0;9 I8 o; q& m2 ?( U
  63. * p: Z/ s- p! Z3 H. d$ A  k2 v6 [
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);3 r, i# ?, o) r. v
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);2 D& i* Z9 H# u1 F& W$ k
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);& z( \5 Q/ d: Z
  67. / ~2 }3 [* Z1 g" Q2 ~, I3 K5 S
  68. dma_addr_t dmaphyssrc1 = 0;
    / r, W/ h8 a  O0 U4 u
  69. dma_addr_t dmaphyssrc2 = 0;8 J2 t+ H9 j* U
  70. dma_addr_t dmaphysdest1 = 0;  j) i+ R/ @, C/ s4 S' e; p
  71. dma_addr_t dmaphysdest2 = 0;( n; j+ z" K# s# q

  72. 7 n+ O7 L8 u% |" H& G6 X# h+ r
  73. char *dmabufsrc1 = NULL;
    ' m! o/ f; ?9 }! a
  74. char *dmabufsrc2 = NULL;
    % Y4 A; o! V) P/ A& ~8 _
  75. char *dmabufdest1 = NULL;3 P1 t7 T  [; r0 b
  76. char *dmabufdest2 = NULL;. f5 B& B4 h7 `* |
  77. / V" }0 ]5 X0 F2 ]0 B5 t, z
  78. static int acnt = 512;
    3 |* J: i5 a! \/ D7 z. K& `* H
  79. static int bcnt = 8;
    + ~/ B$ L1 M# o" n2 _; D- ~, U: S
  80. static int ccnt = 8;
    5 \0 c- ^1 ~" f8 @% H, r1 [
  81. $ i. ~7 s# A/ G% g+ e
  82. module_param(acnt, int, S_IRUGO);
    ; k( x: v% X5 z& E0 k) K
  83. module_param(bcnt, int, S_IRUGO);
    ( @1 D* I0 |/ c1 {' o
  84. module_param(ccnt, int, S_IRUGO);
复制代码

( ^" }3 F# Q: {% n6 a0 s1 I" d7 s% |. E8 N# b; a
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
0 \; U+ y9 _' q8 f6 u) H6 W7 larm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
6 R9 @. e) }0 W0 E, {! i) S, _     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
# @0 ?; ]( b' ]! X$ t( U, v: Z4 `8 q; O. M' i+ K! P" I; }# i
3 P; S; t1 U! X: I& T
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则


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

GMT+8, 2026-1-11 18:20 , Processed in 0.039418 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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