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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
# T, C: H7 [! y! o; g
  1. [code]EDMA sample test application
    ' {- @' `4 c( J
  2. /*
    ; T, @4 n' P5 s  l+ O, ~1 Y+ r
  3. * edma_test.c
    : |/ N8 d' P0 P& l- ?! w0 w
  4. *( f+ Z" m5 G% u/ `6 E7 N1 d
  5. * brief  EDMA3 Test Application
    + V  e5 p, C# h3 ^* D5 T4 h* v* |# k
  6. *- D$ S1 b; @2 B: g3 w/ O% y" d
  7. *   This file contains EDMA3 Test code.
    . W6 h5 Y+ Y: ^" ]. a4 G9 d  S
  8. *+ Z2 M- z8 l9 E. s; M
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    9 Z9 a% |" B; J
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    2 Y3 i5 E' a9 n
  11. *         TO CHANGE.
    - ~) j0 m' K! T& L
  12. *
    " [% o. Z% K( {; J$ b: h4 E
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    / v+ s, t# N6 x) d' ?0 y+ m
  14. *, r3 ^+ n5 g, \
  15. * This program is free software; you can redistribute it and/or3 @* K7 w* a- B2 `8 |
  16. * modify it under the terms of the GNU General Public License as
    9 K' h/ _6 J7 S; ?. U
  17. * published by the Free Software Foundation version 2.2 P  O' _8 x  y5 ?; s0 |
  18. *
    & X; W7 B2 `' ?0 w, a7 z
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    8 C) d$ I0 k& @% q8 s! I! y
  20. * kind, whether express or implied; without even the implied warranty% i/ G4 z/ |; n3 V1 w* q$ Q4 f2 l
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the9 f: K' e# R2 |2 r- [
  22. * GNU General Public License for more details.
    * G4 o; f: n) K1 `1 _6 N5 s
  23. */
    / W5 y8 d( u1 n) Q8 H
  24. % @; N# |6 N& R+ L: L; }
  25. #include <linux/module.h>
    5 W' g3 U% |, I9 W5 w
  26. #include <linux/init.h>
    $ T5 C! p4 ]# B$ r5 t( l
  27. #include <linux/errno.h>1 H3 |5 T* R1 b$ r: \
  28. #include <linux/types.h>
    ' f0 n+ G- A! O# F. @' |
  29. #include <linux/interrupt.h>
    4 }+ d5 V4 Y! `
  30. #include <asm/io.h>6 C! y4 P& H  n9 y1 Q' |
  31. #include <linux/moduleparam.h>
    , R: y7 v% p% O) [5 G6 J
  32. #include <linux/sysctl.h>
    ( T! x9 z# p% [# K
  33. #include <linux/mm.h>
    - z7 I, g. t! v
  34. #include <linux/dma-mapping.h>
      j+ v5 l: S' k  S) V; x) r

  35. " B! F6 p/ W- w/ F3 |9 W9 A
  36. #include <mach/memory.h>
    ( a+ H0 W5 Z4 l
  37. #include <mach/hardware.h>. m6 |$ _9 w! P6 v8 Y
  38. #include <mach/irqs.h>
    2 T6 w$ K3 ?: |+ r0 J  F
  39. #include <asm/hardware/edma.h>
    9 ^9 q& l7 ?0 v3 f8 K+ r$ H$ t% |
  40. ( A/ y: ^  O: u/ r' M+ ^4 H% }
  41. #undef EDMA3_DEBUG
    6 @, s, x; ]# W# J
  42. /*#define EDMA3_DEBUG*/
    1 e$ y; D2 T+ T" a. Q! W
  43. ! j9 }8 R' B, |' j: b
  44. #ifdef EDMA3_DEBUG% G2 ^8 u8 |# J. L! B8 D
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS). M* C) U  `4 J; l0 W1 c( i2 h
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    ; D# a) m4 h. K& N* l
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)- I% y3 D' D; u3 K# O- E
  48. #else
    7 x3 K1 I/ B' k* u, M6 n
  49. #define DMA_PRINTK( x... )
    " b& G/ n9 ~+ c  w- b$ m& B: a
  50. #define DMA_FN_IN
    7 p8 }! w$ H2 W8 {+ ]3 [% x
  51. #define DMA_FN_OUT
    0 W) i  }0 K; d, B" ^, l  O# Z0 f
  52. #endif
    . I4 }/ o7 Y1 \8 b
  53. + K7 R. I, ~6 f* D1 ?5 A! l. a' u
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)$ B8 d: C$ Z" Z8 w5 t8 V( Y
  55. #define STATIC_SHIFT                3% A8 A9 u$ g+ C
  56. #define TCINTEN_SHIFT               20
    + [. }/ o% A) V, N8 J: A
  57. #define ITCINTEN_SHIFT              218 R5 Y( H6 n- t- T& u8 i0 l
  58. #define TCCHEN_SHIFT                222 A) o; g0 \/ W9 T7 V" U1 M8 j0 s
  59. #define ITCCHEN_SHIFT               23- b2 `& d6 V6 D

  60. 7 n" o9 N2 n' k8 T& p8 a3 Q, ?
  61. static volatile int irqraised1 = 0;8 V! t9 p4 V5 Q" i0 y- l* ^# ?
  62. static volatile int irqraised2 = 0;* P1 D0 \) [( d, s& ]/ R" r

  63. " x& U/ S. J& Z5 l: E1 u( b
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    + z2 v" \2 E1 j: N* O& b$ m: e
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    * f7 A1 P3 `/ u9 Y. A, g  Q
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);3 \* [4 p( \  R; X

  67. 5 ]$ w+ u% ^; A- E- j  u! G
  68. dma_addr_t dmaphyssrc1 = 0;& g4 g8 G  d  ?4 {# s) W* M3 z5 O
  69. dma_addr_t dmaphyssrc2 = 0;
    1 I) c* P' z$ h+ t
  70. dma_addr_t dmaphysdest1 = 0;
    8 j; s  \9 C. U4 I% q9 d
  71. dma_addr_t dmaphysdest2 = 0;
    $ C% t/ w1 @. h

  72. - \! i" A/ z6 v* }8 s+ k
  73. char *dmabufsrc1 = NULL;
    ) x' P4 V! L) T/ o7 n
  74. char *dmabufsrc2 = NULL;& {5 @' ?  \( }9 A' i# `
  75. char *dmabufdest1 = NULL;
    ; {1 @- M0 G+ b% J5 u
  76. char *dmabufdest2 = NULL;
    4 ^4 E, w: M- q4 o9 Q, V1 [
  77. 4 k* @5 V+ L6 {
  78. static int acnt = 512;
    0 N% g2 S, t9 w0 V
  79. static int bcnt = 8;9 n8 @% k8 B0 b- [
  80. static int ccnt = 8;* R- w  ]" Y5 d1 r
  81. " b& o1 O, J# t. j3 g
  82. module_param(acnt, int, S_IRUGO);
    + m  N; m/ q: Q8 w# q; G9 O
  83. module_param(bcnt, int, S_IRUGO);
    . [& ]; E2 r) G$ @
  84. module_param(ccnt, int, S_IRUGO);
复制代码
6 I. E. Q$ Y" f$ H- G: v
2 G/ y+ T. x$ Z: Q0 V& m# f# r
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
, C% u, D/ E% ?) f. ~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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。. P, Q. F+ S' ^( o
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。& Z4 \  I3 J6 h
- M+ g: [5 ?  F, J9 p' p, x! g
2 q& n4 b3 X, m4 i) K
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-4-6 22:44 , Processed in 0.038925 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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