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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
* i& B# K0 z1 d6 d8 q' Y2 r2 I% f
  1. [code]EDMA sample test application
    / k3 A. e' w, M& L+ v7 ?. V
  2. /*
    % p6 Q9 {; H. g& \. t4 w
  3. * edma_test.c
    " x& f8 M- d- w6 q& p
  4. *$ i# _' d: K& B8 Z! E# H
  5. * brief  EDMA3 Test Application
    9 A, v( m+ O$ d) T8 T
  6. *6 o( i* C5 C) v  N& C- _
  7. *   This file contains EDMA3 Test code.- e% V7 E2 a' P9 x" a! H5 p8 t- |
  8. *" A+ T- h! n* l& n2 G+ P4 O
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE- l" y! F% n! J: t; w6 Z! P# V; n
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    : @: r( F4 a% E$ a! j- H9 f6 o
  11. *         TO CHANGE.
    , p! |5 s* @% |1 z" L- r
  12. *
    3 S3 c- t( H  ^: q/ e
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/' A0 t' ]+ u) O- Z+ S0 S: }$ V0 b
  14. *  s3 M' N/ O5 E; ]6 Q6 w
  15. * This program is free software; you can redistribute it and/or
    4 F% t* ^0 a, }9 [& q9 T
  16. * modify it under the terms of the GNU General Public License as' k' _9 G" R  r7 j; A; R/ k
  17. * published by the Free Software Foundation version 2.4 |1 s$ F) z9 _& c
  18. *
    7 w9 {6 C0 _8 C$ ]0 q
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    / N% a' }8 a& z' C, ~! _
  20. * kind, whether express or implied; without even the implied warranty- `# W, @. [9 I
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the- E! v- c: j' h7 f3 q+ p
  22. * GNU General Public License for more details.
    8 j2 W' x% l' t: j/ w
  23. */
    0 L& V" W# c( X' a3 k1 X* b

  24. , f' A  [6 @) P& Z4 q# ?9 t3 c
  25. #include <linux/module.h>; v  m, ?% F+ r5 n0 ~0 g2 a
  26. #include <linux/init.h>
    ( S) F, ^" c4 b  f$ B
  27. #include <linux/errno.h>* g8 |7 X' N4 a# p1 h5 F$ q
  28. #include <linux/types.h>
    8 h/ j. V  u' V" A
  29. #include <linux/interrupt.h>% `" g7 r1 K: ~: U6 n
  30. #include <asm/io.h>0 P5 Z+ D2 V! N1 I. K  }, [+ x
  31. #include <linux/moduleparam.h>
    , s! d0 C& h# Z  A
  32. #include <linux/sysctl.h>
    1 F8 V5 @7 R. \/ x/ ~: @$ ?
  33. #include <linux/mm.h>; S( |, }' {3 b7 }
  34. #include <linux/dma-mapping.h>8 D: g  Y, k2 I! D* H

  35. 7 N4 q) c* C$ e; v
  36. #include <mach/memory.h>$ v( ?2 H( A6 q6 }6 v
  37. #include <mach/hardware.h># p# }' [5 a& v; \& e( a3 d
  38. #include <mach/irqs.h>. E4 X& I5 O( M& a9 _0 p1 o8 \  _# B+ [
  39. #include <asm/hardware/edma.h>" o) r% |5 b8 l! t7 w* y

  40. % S$ h2 e* E/ B2 C& ?; V& H' L
  41. #undef EDMA3_DEBUG( k$ K% C+ q1 A5 D
  42. /*#define EDMA3_DEBUG*/
    8 M  A" W) }# q0 o' l! g

  43. + b% Z8 Q; x# H9 }2 z1 F' @- j
  44. #ifdef EDMA3_DEBUG: e& Y& [0 O. N( Z
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)' u, Y# g/ C$ Y
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)* Z- V' n* o" P
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)! ^" Q% x) r+ h* I
  48. #else
    5 @2 C  G6 H5 R
  49. #define DMA_PRINTK( x... )
      n/ e$ N. h/ K: P: I
  50. #define DMA_FN_IN
    1 @* }  f) Z% O4 m
  51. #define DMA_FN_OUT9 {* b9 [" w8 B8 U
  52. #endif
    - Z9 o( b$ H+ w6 {9 Y" O

  53. 7 p8 `1 T0 ~! V2 U+ ]  U7 X" z
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)/ K- h" c/ h6 v9 p3 M0 D8 t9 W! z# n' Y
  55. #define STATIC_SHIFT                3* }- n2 l+ M" p  h
  56. #define TCINTEN_SHIFT               20. D1 n. c' k" b& T
  57. #define ITCINTEN_SHIFT              21
    . l+ m: D6 e, {% e6 d0 r5 t
  58. #define TCCHEN_SHIFT                22& m3 K# {! }' W2 e$ z, X- [
  59. #define ITCCHEN_SHIFT               23
    4 n6 c  B4 X2 P; Z

  60. " ?, F4 c$ i; N9 R& b0 i
  61. static volatile int irqraised1 = 0;
    1 C4 Y7 [: S6 |, z6 R# O) g0 Q$ s
  62. static volatile int irqraised2 = 0;( J- m8 i( K5 X1 g! M

  63. ( z" t( T9 c/ m& {1 Q8 J
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);; \3 y4 L2 z" l3 s
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);% Y( Y; Z- i4 ?$ j
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    % ]2 l# g" h# J3 D7 h
  67. 3 |& r- O& n/ B- y  d
  68. dma_addr_t dmaphyssrc1 = 0;
    5 N; P  Q0 Y+ s* f  N
  69. dma_addr_t dmaphyssrc2 = 0;+ ?- P3 a- x$ h5 E' [! L
  70. dma_addr_t dmaphysdest1 = 0;, x5 _! E. e3 C% X
  71. dma_addr_t dmaphysdest2 = 0;
    ( _3 T, F4 g& a) g

  72. & ?0 V3 p! X9 Z
  73. char *dmabufsrc1 = NULL;% W1 z. {  t* }* T$ ?" s5 f2 ^
  74. char *dmabufsrc2 = NULL;4 u5 O- t" e) n' h
  75. char *dmabufdest1 = NULL;
    1 C% R( v6 h0 p3 {
  76. char *dmabufdest2 = NULL;# g3 `% S1 j) g8 k7 L7 G8 _/ A
  77. 7 T; L, y; Z/ {+ y8 v3 t/ F# W
  78. static int acnt = 512;
    : _; F: D1 x( b  i. m
  79. static int bcnt = 8;
    9 |' m8 n) I. Z" s8 j
  80. static int ccnt = 8;% `2 s2 V) Z% L7 {* O+ G
  81. " n  v' S3 S7 u, z' ~
  82. module_param(acnt, int, S_IRUGO);8 `' W6 u$ \7 p% {5 i; J# q
  83. module_param(bcnt, int, S_IRUGO);5 ]! t7 V$ B8 o# s$ m6 s
  84. module_param(ccnt, int, S_IRUGO);
复制代码
8 s) r9 n7 w) j& }/ |1 u" V

& i0 F3 P. g1 a4 R      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用, M/ \8 }3 X' f. l( W
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。8 q! T1 O0 |( M* k3 o
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。2 g2 U) Q, w5 i- T# n
' C/ ^5 c  }/ ^  V5 }& Z8 }

: q7 _6 s# M6 r4 k' X
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-11-22 15:20 , Processed in 0.054502 second(s), 24 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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