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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |正序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑   R3 I" T9 k  {. X6 @& a
  1. [code]EDMA sample test application" P6 b/ _/ _1 B: Z4 S) g
  2. /*3 [2 `' }+ b& @9 ?
  3. * edma_test.c, o0 M/ o: J/ W6 L' ?) d
  4. *
    4 ^- K0 ]) J% r* y
  5. * brief  EDMA3 Test Application
      D& T  Y, O3 F- u" p
  6. *
    1 f9 q: z# }( P7 o' \
  7. *   This file contains EDMA3 Test code.0 E5 _' j9 g: g- e" K
  8. *
    # j% x9 H$ b/ m9 j# t9 W' [
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    " W$ c& {5 F" Q# P+ X( W- S
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT, A9 e. L. z' V0 y$ O& g4 v
  11. *         TO CHANGE.
    ' Z% d7 L5 [1 _* d8 q$ b
  12. *
    8 q# d- I6 k0 N3 {- g  P  U
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/" b( L& O; h: H" I
  14. *" a+ K' [, B3 C) A. H
  15. * This program is free software; you can redistribute it and/or
    5 [) w* R# O/ _* L8 P$ N
  16. * modify it under the terms of the GNU General Public License as- x' c. }- }# c# K2 T) u
  17. * published by the Free Software Foundation version 2.* l$ k2 H' |3 Z0 _
  18. *0 c! q1 U) w1 |& B8 H3 \
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    - X" W1 n# M+ L: a( R; h+ M
  20. * kind, whether express or implied; without even the implied warranty1 I2 c% W8 [2 i5 c
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    7 \# ?9 j9 w0 E# O$ R& N9 E: [' ^% Y
  22. * GNU General Public License for more details.
    : b' r  ^, h# v! c, t& o
  23. */' d3 ]  i8 s" A
  24. 8 i/ V" y0 p# x- q" J* a: F
  25. #include <linux/module.h>
    : r2 j' j. W" A6 S/ x- ]5 m
  26. #include <linux/init.h>4 M/ r' y) W7 M$ n- A
  27. #include <linux/errno.h>
    . Z3 e( H2 f# g1 ~4 ~  G
  28. #include <linux/types.h>! j: x9 k! B! J) O7 ^
  29. #include <linux/interrupt.h>& }* a8 k" l" K
  30. #include <asm/io.h>" D4 ]% O0 Q/ [* T: c
  31. #include <linux/moduleparam.h>
    4 E) v: Q8 G5 x3 ]: T6 a
  32. #include <linux/sysctl.h>
    ' l0 V6 z! ^. T, C, V
  33. #include <linux/mm.h>
      L8 E  z' x' H; E
  34. #include <linux/dma-mapping.h>1 o& G/ b& w' _* l/ r2 j# G

  35. 7 ~9 g0 R5 E( c8 u- E4 i- M
  36. #include <mach/memory.h>9 w6 R' q4 T% v3 X, N/ d" n( \
  37. #include <mach/hardware.h>
    & ^5 v# ?* |% R! A
  38. #include <mach/irqs.h>) `, H! y+ |/ x. G& W: ~
  39. #include <asm/hardware/edma.h>7 V! e# S6 r' f! y. l1 Z

  40. . U; e3 S8 D  w4 j0 M
  41. #undef EDMA3_DEBUG
    1 u8 @- k: p+ ]/ b, m, V, X
  42. /*#define EDMA3_DEBUG*/
    ; I, u! @# @0 _5 D1 w0 i2 _
  43. . Z" a8 s! ~( s
  44. #ifdef EDMA3_DEBUG
    6 `5 u" }; q% W6 g& a
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    0 d! w, h! C' f
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)& {: }: J' ]2 K% d! X0 m
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    / e' P" |* [1 ^0 R3 e
  48. #else! U- b4 J! ]- e5 D. U) T
  49. #define DMA_PRINTK( x... )
    " S) `: i4 E! J4 }5 q* F% O
  50. #define DMA_FN_IN; k* x  F$ h2 T, Z) w( Z
  51. #define DMA_FN_OUT* F! _4 h( u# G5 C
  52. #endif0 H  k8 Y0 k4 r7 l, D2 A; W0 X; M$ _

  53. & n& w- ?; s- m4 F
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    ; d; Z7 x2 s$ g, m5 j6 L8 F6 S
  55. #define STATIC_SHIFT                3& g( g1 r2 l% a! O( Y3 N, D
  56. #define TCINTEN_SHIFT               20
    7 D* H: U* F8 x3 D
  57. #define ITCINTEN_SHIFT              213 J3 w. M5 y: e3 \; F
  58. #define TCCHEN_SHIFT                22
    / S; ^7 Q' s+ J. }- f
  59. #define ITCCHEN_SHIFT               23
    9 X5 ]) n- y/ F# U# O

  60. / W2 C/ E4 v4 D) M# [, o" G# f
  61. static volatile int irqraised1 = 0;
    9 z: ?$ f* ]7 s/ {4 i. }" }2 m# V3 i
  62. static volatile int irqraised2 = 0;+ }! y0 L4 n  Y5 _, L
  63. # O2 W) f+ }* Y" x
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);% E: G1 R( @0 L3 ]% t
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);3 J4 U/ V, P/ E' u7 X" s
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    * m& Z# S  _, J% C

  67. " J5 q- m. m, \
  68. dma_addr_t dmaphyssrc1 = 0;
    7 m( ~0 @( k4 r# u6 n: K- J( f
  69. dma_addr_t dmaphyssrc2 = 0;% X) a0 ?) S, `2 p  C! B/ W: D  f
  70. dma_addr_t dmaphysdest1 = 0;
    ( b3 ]3 l' n$ q, h6 b
  71. dma_addr_t dmaphysdest2 = 0;
    # M! P) X( N% @3 E" e
  72. / R$ i3 f* e1 u
  73. char *dmabufsrc1 = NULL;
    ( W: }+ i6 [+ C7 z
  74. char *dmabufsrc2 = NULL;
    , t  w6 D% f. w7 V# o
  75. char *dmabufdest1 = NULL;5 a2 {& m  y7 q
  76. char *dmabufdest2 = NULL;
    - i3 @: K+ F8 M0 e  [

  77. ) a6 ~& K7 n) {6 O: s& P/ e& d
  78. static int acnt = 512;
    5 P' \3 A4 ]. ?) @. B
  79. static int bcnt = 8;5 R& {- B; G% ^
  80. static int ccnt = 8;
    4 w/ f' q7 \3 i$ l
  81. . ?* q# ~. A2 Q9 f3 L" l2 j
  82. module_param(acnt, int, S_IRUGO);. a; Z8 A8 S4 G+ j
  83. module_param(bcnt, int, S_IRUGO);/ s: ?6 F2 T6 R8 d% i
  84. module_param(ccnt, int, S_IRUGO);
复制代码
$ i6 E: y: \) k/ h

: E& z  R3 L2 X6 K% O      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
# M" h9 r2 \3 O" 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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。1 }2 c$ V" t1 h
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。* ^% i' m( D2 y, L

' S8 p- X. o4 h0 G& l6 s' ^3 O: Q3 U' O( S, F
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2026-1-2 13:37 , Processed in 0.037164 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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