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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 3 _# v# `: v) h8 z6 x) `# N7 W
  1. [code]EDMA sample test application
    2 D0 z1 ~: ?: R' R5 z" x: O6 a2 N( l
  2. /*
    & z9 d1 v1 N& {$ b3 w( h
  3. * edma_test.c" E5 p! H- i  c# h5 B9 J
  4. *( X2 O  q. L" G7 V
  5. * brief  EDMA3 Test Application
    * z5 [9 q  p4 O2 c' T
  6. *0 O$ S. R: o, u+ ^2 i
  7. *   This file contains EDMA3 Test code.
    : |/ q: ?* ~- z$ M4 S& F: A
  8. *
    * `. K' Z- p5 Z4 _. a7 F3 F+ V
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    9 u" Z! K5 M- w4 c) \1 C2 ^
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    ; i  x8 f$ k7 X: v
  11. *         TO CHANGE.4 U6 Q2 i% \0 u
  12. *
    ' Q9 J- w1 C, x5 F; }! i
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/2 ]" [; L5 Y! Z. ~4 h5 K% I/ J
  14. *& b1 W- c' l' r
  15. * This program is free software; you can redistribute it and/or" f; h4 {; ]8 H  }! {9 V4 p' u8 R
  16. * modify it under the terms of the GNU General Public License as
    * S" V* e  z0 o% w# C) W; u
  17. * published by the Free Software Foundation version 2.
    + w! H+ Y2 ^; F9 f7 T0 h6 ^; `" M
  18. */ [& ^& `2 R" T( c6 }
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    . V! ~, U2 B- s7 F# s
  20. * kind, whether express or implied; without even the implied warranty
    - E! f) f- o* d) W3 U
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    2 u6 @2 F2 t4 j/ b+ X. v& n0 q
  22. * GNU General Public License for more details.2 P7 Z1 S% b% V/ @
  23. */
    3 @, A' ]) a, y8 u" ?! ]
  24. , O0 V2 \: c6 \* g' x# z3 ]  \) s  f
  25. #include <linux/module.h># b- `/ Q' Z, c9 T
  26. #include <linux/init.h>
    $ Q& A1 K  P  t5 }1 Z3 U/ U
  27. #include <linux/errno.h>
    # B2 f1 L' `# \2 s2 Q5 @
  28. #include <linux/types.h>  ~1 @  U& h# G, O" \, y; e$ u
  29. #include <linux/interrupt.h>3 k# [) H! q, c/ H
  30. #include <asm/io.h>
    " s- K8 _1 E. u) v& D' H0 h
  31. #include <linux/moduleparam.h>& K6 S* L+ I' }+ D! ?7 [3 f
  32. #include <linux/sysctl.h>
    & E9 f( g0 a$ ^' ~2 o$ S
  33. #include <linux/mm.h>1 h/ O; C' U" {
  34. #include <linux/dma-mapping.h>4 u$ j2 ~1 ?8 f- n
  35.   ~; g' V) k: @0 t) h6 z3 W
  36. #include <mach/memory.h>
    * r; P. p5 a$ ^1 |: a+ q, a# n0 e1 k
  37. #include <mach/hardware.h>: ^& I# ^& E* N
  38. #include <mach/irqs.h>
    # h. L2 ^- ~. i# X0 \5 B' V. ~! k
  39. #include <asm/hardware/edma.h>
    7 B; ^( s! n3 D1 F0 a

  40. ' K1 e" r; {; t3 r4 h% N0 K9 @
  41. #undef EDMA3_DEBUG' _0 O$ }6 q( d% R/ j" r
  42. /*#define EDMA3_DEBUG*/" @. O7 Y  k7 y% x9 E4 N
  43.   M8 ]" Y3 p; v1 a  }
  44. #ifdef EDMA3_DEBUG+ U. V: B* ?, M4 f2 P' Z
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    " D) H) b& @  j' y5 V6 d" t  U- m* f
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
      {1 D( A6 \: R- O$ i& s$ w" X
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    3 y6 y1 ?. l; J5 L3 V
  48. #else) `3 [1 g6 l! [1 [9 Z
  49. #define DMA_PRINTK( x... )
    - Z9 r6 Q4 J0 L2 q; F5 R1 [
  50. #define DMA_FN_IN
    / D. c6 D* b7 P4 G. b6 C) W8 R
  51. #define DMA_FN_OUT! \  B$ C: f% d
  52. #endif7 s' S, x! M$ a5 D$ a3 e# X

  53. & o) Z# M" y  u* x8 T3 N; {
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)7 O; |! O) I; ^; H4 e" U
  55. #define STATIC_SHIFT                3
    3 _" a7 n: E1 t
  56. #define TCINTEN_SHIFT               20% D% e$ b- |2 @: h9 b: j/ I6 n
  57. #define ITCINTEN_SHIFT              215 n( H8 W7 W& O5 d
  58. #define TCCHEN_SHIFT                22
    $ A9 c0 t& p# o/ w1 o
  59. #define ITCCHEN_SHIFT               23- U( X) Y' |; [4 j3 h8 ?3 D

  60. 2 e  J. b, H$ E. e
  61. static volatile int irqraised1 = 0;% @: o, o% D- m4 g
  62. static volatile int irqraised2 = 0;
      E+ `+ L$ H& O( P9 u* L

  63. " S# n7 r$ L. }) D
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);$ H2 Y& \, Y# u' r
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);9 Q" ]1 c( i# N
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);6 i* s% C3 f+ V( [" c

  67. 1 `% X0 y7 i+ S& f4 r/ y
  68. dma_addr_t dmaphyssrc1 = 0;% g( g( M4 X8 I5 y
  69. dma_addr_t dmaphyssrc2 = 0;
    . l5 c! n: o% W1 H8 [: v8 Z
  70. dma_addr_t dmaphysdest1 = 0;  t! {2 I' G; T. W& }4 d/ o, \% [, P! `# D
  71. dma_addr_t dmaphysdest2 = 0;
    8 O& n  f& j! F

  72. 5 d  I6 ?; J# v9 h% _) ^! Z' q
  73. char *dmabufsrc1 = NULL;
    ' [' x  R: P/ p, ]. k' i7 B
  74. char *dmabufsrc2 = NULL;1 ]6 X1 s/ u" O
  75. char *dmabufdest1 = NULL;1 U" ^+ B7 k: i& d0 r, U+ S
  76. char *dmabufdest2 = NULL;( e* q: \' S7 D) \% t

  77. 6 e, Q0 @3 B' f1 ?, Q5 Y) X
  78. static int acnt = 512;
    + f0 ~: Q/ Q1 S
  79. static int bcnt = 8;% J; ^8 k9 @/ n1 H0 \0 i& W+ h
  80. static int ccnt = 8;+ Z2 H- v3 _8 {& k5 [5 c# b. k
  81. , r) z' _" j. N# z2 p- Z/ R# B' N
  82. module_param(acnt, int, S_IRUGO);3 G" j5 {6 u; F  |. o
  83. module_param(bcnt, int, S_IRUGO);
    1 F" W: A5 H0 D, G3 L: U( Y
  84. module_param(ccnt, int, S_IRUGO);
复制代码

& k9 d2 s% V) @) R& m* }: I) u2 @$ n4 R& E1 `5 g" c
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
, \* {: {  r3 e) X3 H. z, L2 a/ rarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
: v- F) L9 w1 P/ V  A" _$ k     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
& {: W% x3 F: y/ X7 q4 [9 I/ s/ O! B. J! j

$ i6 l. M1 ]  t4 l/ [
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则


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

GMT+8, 2026-1-11 05:53 , Processed in 0.040289 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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