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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |正序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
. y& n9 o4 [5 \$ L! o0 N, J$ j
  1. [code]EDMA sample test application2 \5 q: ?! @+ v) Y( i  B8 O3 O& F
  2. /*
    0 P9 j5 m+ ]! A1 t# y  S) S7 I
  3. * edma_test.c
    6 w; o# `6 v/ O. |, j5 Z
  4. *
    9 T& k" s; c0 H+ h  v8 E
  5. * brief  EDMA3 Test Application/ n* [8 ?* w) t- C( M+ E: _8 @
  6. *
    ' ?0 B% U3 |4 X; g( O& D
  7. *   This file contains EDMA3 Test code.
    ( X1 E& e# j" O) D5 P7 R" }" x
  8. *0 L2 m+ G  R% ^+ d  Z! w
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE3 {$ P2 V( h# g" ]' o, n9 n
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    , w7 t, d" P+ ~+ {
  11. *         TO CHANGE.; X* t6 e" L. d& A2 u; i: J& t! N
  12. *8 y) N& A& l* g/ E' G9 @
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/( o- ^" k8 L! V$ P0 l  V
  14. *8 F$ s) f7 S' R+ X
  15. * This program is free software; you can redistribute it and/or
    4 U( g, z, b: L& d; r2 k0 ~" P
  16. * modify it under the terms of the GNU General Public License as
    2 N  C- F4 z( Y5 U
  17. * published by the Free Software Foundation version 2.- R; t# f5 ]; V+ N5 a
  18. *9 @/ a& H4 u: m3 F$ ]/ ]/ @* R
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any: |( i8 }! {# ?" J; ?2 X% ~  ?& B
  20. * kind, whether express or implied; without even the implied warranty
    ' x+ Z/ Z$ }9 l2 `  I6 H
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the; X% l4 N) {7 O# Y8 \
  22. * GNU General Public License for more details.: c1 R5 x& U! c; @
  23. */
    3 }! r/ L4 E7 v0 T8 J

  24. 9 q0 V* m  m6 P" q/ Y+ D
  25. #include <linux/module.h>; I" @& T4 Q# Y( g  v- Q7 e
  26. #include <linux/init.h>
    ' z% D4 S' [9 U' L" e
  27. #include <linux/errno.h>
    9 Q' {4 S: s5 N' f- I& p) }2 z% W! q* t
  28. #include <linux/types.h>& c2 W% g8 Y0 f+ ~; e
  29. #include <linux/interrupt.h>0 M# T: q/ N( H% V9 d6 i& Z
  30. #include <asm/io.h>  D' o5 Q! F# ], h" g  c
  31. #include <linux/moduleparam.h>
    / p) T5 ]- D  C. F; A
  32. #include <linux/sysctl.h>
    " ]6 \. R. k  p% K  D
  33. #include <linux/mm.h>7 v' v) c: \' e* ]' D, A+ x8 U
  34. #include <linux/dma-mapping.h>
    9 E2 j6 _& g, p

  35. + p) ~7 z( w  H0 L( ^
  36. #include <mach/memory.h>" n: U* A4 F& o" d' g( B) g
  37. #include <mach/hardware.h>
    3 D0 A0 n$ u! J5 `& B( Q, G% a5 A" V
  38. #include <mach/irqs.h>. y* u9 }0 ^; P. T  @  L- U
  39. #include <asm/hardware/edma.h>
    8 ?5 {3 P$ P( ^: s. {
  40. . q$ H+ r& V' l" B2 u$ z
  41. #undef EDMA3_DEBUG
    6 Y* O* Q8 ?( [" v& I
  42. /*#define EDMA3_DEBUG*/  n1 ~& Y1 j+ D: u+ j
  43. ' o+ s  T$ U+ F" U% G
  44. #ifdef EDMA3_DEBUG
    + n& ^4 `: _9 ~6 W4 X
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    / f) Q* C1 Y& Y* O; [" g8 U  r0 y
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)0 K0 S) z& t- m+ ^# K" R
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    . `" w1 Q( m6 _  j4 u9 j4 f0 f
  48. #else. M; W3 S2 H2 G. n
  49. #define DMA_PRINTK( x... )
    / }6 E- w& F- ^
  50. #define DMA_FN_IN; U  r# l! p9 S5 d- N
  51. #define DMA_FN_OUT
    3 M, f8 i8 z  h/ m5 ]) c  b7 Z+ g
  52. #endif' x- V+ [* {$ \* E- q3 ~6 G" V: i
  53.   w: V- n8 q! }) G4 x
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)2 T( E8 r7 r$ k4 N4 N" ^8 x
  55. #define STATIC_SHIFT                3" @8 }8 x, E7 ~! l: w
  56. #define TCINTEN_SHIFT               20
    ( }; z9 L/ f: w1 w2 N9 k0 V
  57. #define ITCINTEN_SHIFT              21; Z7 G* A& f$ k5 Q
  58. #define TCCHEN_SHIFT                22
    $ T3 N9 z  M7 {9 `5 [
  59. #define ITCCHEN_SHIFT               23
    & n% K; [2 c; b+ a" {

  60. ! n' g$ t/ f, o( c$ z+ f
  61. static volatile int irqraised1 = 0;0 }1 |5 k- j5 v( T6 i# ?# I% V. ]
  62. static volatile int irqraised2 = 0;
    - }5 r, [& [, J( e% ]6 F5 F( p0 P

  63. ; D, r# Q; D- n' j3 k3 Y9 [; i4 u" Y7 _
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    9 k. G; a! M0 l: g
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    . S# k3 B2 V7 a- Z1 n. t6 V
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);' b" `* [* W# m9 W5 u' `

  67.   U5 @) v. B5 g" ?) U
  68. dma_addr_t dmaphyssrc1 = 0;
    / Z/ ^. z# Y; r! d: }4 g* j( v
  69. dma_addr_t dmaphyssrc2 = 0;" M% ^2 M# ^0 ^, F: C0 a8 A
  70. dma_addr_t dmaphysdest1 = 0;4 |1 i" n  ]# P$ Z; b7 h. {8 W) b
  71. dma_addr_t dmaphysdest2 = 0;) ]3 a- ?5 d8 b9 X- R

  72. 0 w5 j- c) u& G) F
  73. char *dmabufsrc1 = NULL;4 v" _( ^  y( x7 p; J
  74. char *dmabufsrc2 = NULL;& a- O  E: G+ Y- Z" @
  75. char *dmabufdest1 = NULL;
    # l4 l. b1 c4 g6 R5 M7 [3 C8 `
  76. char *dmabufdest2 = NULL;
    - A6 i( @7 T  Q% {4 ?" X: x; V7 A2 u

  77. 3 j6 j" @/ d9 J% K. H
  78. static int acnt = 512;2 ~" d. B. |6 q  E5 z/ c1 M
  79. static int bcnt = 8;& e  E1 o3 P* U+ u+ J
  80. static int ccnt = 8;) e' \& L4 o: X8 _0 m! E
  81. 7 r, A$ u5 Y' m) V( E2 M0 o, v
  82. module_param(acnt, int, S_IRUGO);9 X% |6 n# }; r4 }
  83. module_param(bcnt, int, S_IRUGO);
    6 v* v. R$ z7 E$ ?
  84. module_param(ccnt, int, S_IRUGO);
复制代码
# O; l# g7 D/ }$ F

* W7 F" ?2 Y8 Z3 a1 V* ^      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用" o+ l) ^' j+ K0 {1 K
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。: c6 B4 K: F; _8 L+ {. L* I. a5 A
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。- K% g, c; _2 ^+ }3 H
& P, K" F8 b, v8 E3 [9 o, \! O
7 C7 o' g( [! C& t* S$ Z  }
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-12-31 18:34 , Processed in 0.041742 second(s), 27 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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