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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
; C" g6 K* M/ q' u0 D0 A
  1. [code]EDMA sample test application
    - W0 U& I6 Q' _
  2. /*
    / a! `" p. C2 M
  3. * edma_test.c2 k2 j8 R5 c, o; J- C8 @" y
  4. *$ w+ |3 m. [% r: w0 x8 d* \8 q
  5. * brief  EDMA3 Test Application; D# z. q. v  A! s' g+ I0 N
  6. *
      v5 u' Z* N; i- W, O0 g
  7. *   This file contains EDMA3 Test code.
    . E2 W+ i, n9 l8 ~1 y& s
  8. *6 m! B# d8 ]5 u. p7 b
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE* d! v" K8 @7 Q- L. F1 l! N
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT/ L% u! z9 s9 I" m7 Z1 b
  11. *         TO CHANGE.
    9 P' }( u; k# I' S1 O1 l
  12. *; v. p' O* R8 R& T" N
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com// J- _( o" W$ \
  14. *
    5 S) f* i( J, N( y
  15. * This program is free software; you can redistribute it and/or3 \0 r% e$ O( q( a! n
  16. * modify it under the terms of the GNU General Public License as1 X: f9 g. @" R
  17. * published by the Free Software Foundation version 2.' e4 k7 J. L  O: b
  18. *
    1 p. N! H$ c6 l. J
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    , s: [6 m. f# Q: F
  20. * kind, whether express or implied; without even the implied warranty
    9 \( F9 [% N8 L0 N) ^' O
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the6 u, e# `1 N4 Y$ b0 G1 ^1 L, O! }
  22. * GNU General Public License for more details.* ]# M% L4 |$ O! _
  23. */
    / s5 j0 \( D! r7 R! p
  24. ; T; s) R+ U2 C- M
  25. #include <linux/module.h>
    , v$ ]* ]8 e/ N* z2 k6 `7 P9 [
  26. #include <linux/init.h>+ N, N, N% X0 B/ [/ W# a
  27. #include <linux/errno.h>
    6 E! g6 }$ d' Z( x
  28. #include <linux/types.h>" C7 C  X$ M: O# Q9 D4 @7 J7 ?
  29. #include <linux/interrupt.h>( \- `  ~8 ~! A+ H* Z& H
  30. #include <asm/io.h>
    ) r9 `% l3 j4 l* R4 |
  31. #include <linux/moduleparam.h>6 D' m' Q" ]* u8 ~- t5 I2 g7 l6 o
  32. #include <linux/sysctl.h>' @4 I/ `4 i* P& x+ M8 e1 y! y
  33. #include <linux/mm.h>
    6 v# u9 `5 S- }5 d0 m
  34. #include <linux/dma-mapping.h>" B0 Z1 s9 |6 P

  35.   ~3 ~+ t) I1 u
  36. #include <mach/memory.h>
    ) L, C* k+ |4 Q
  37. #include <mach/hardware.h>
    + O4 m% J& y2 L) _( F' ~
  38. #include <mach/irqs.h>) J6 U6 x( z' n
  39. #include <asm/hardware/edma.h>
    8 E+ @! H" @1 ?) K* y5 u, @

  40. ' g; a% R; B, o- M2 R, f7 R; W
  41. #undef EDMA3_DEBUG
    2 q1 `' }1 Z7 u- I& F& p9 N0 h1 M6 i
  42. /*#define EDMA3_DEBUG*/
    / C9 w# w5 w9 [7 d3 `
  43. $ h6 k% H" I. M8 n0 L8 K# j
  44. #ifdef EDMA3_DEBUG( w: b( K7 h; f4 _( U
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    - L7 x" R$ E' {) P7 l5 D/ A. |
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)9 }$ g( q" l$ B" ^8 z* @: z7 j5 Q
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)' p, ]# d+ v; F6 z
  48. #else
    6 v' o0 M' M0 r% E/ ^
  49. #define DMA_PRINTK( x... )
    , A6 w1 o" Y3 W1 w9 i
  50. #define DMA_FN_IN
    ; w% X- \7 ~  d( K
  51. #define DMA_FN_OUT
    ( w; {5 h2 \+ Q; H: u# `" H( O
  52. #endif! l' q6 W" N5 c4 Q/ m/ z3 L* j3 }$ h

  53. 5 j/ L2 D: O) ^! N5 f/ z' |4 l
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)4 O* D- K, w& z* s! V: h% Y- `9 l
  55. #define STATIC_SHIFT                3& P7 F4 k& _1 e2 J+ X
  56. #define TCINTEN_SHIFT               20) O7 E* A4 H8 B! R% r
  57. #define ITCINTEN_SHIFT              21
    # U2 E0 I$ r$ _4 D8 O0 M; y- I4 D: N
  58. #define TCCHEN_SHIFT                22
    7 L2 P4 I3 A+ E0 Z! C/ o# {* h
  59. #define ITCCHEN_SHIFT               23
    + h4 p- v1 X; b) F

  60. ( w0 b& i! q+ Z  K& s+ S* V3 p) b/ w% v
  61. static volatile int irqraised1 = 0;
    & u& W2 Q- R: k2 S( r2 N1 Z3 Z
  62. static volatile int irqraised2 = 0;9 f8 i) j- q, j; H
  63. ( [7 R& B( u* |; B& i/ o5 w
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    / _& J1 T) V& o- o) q3 L6 C
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);# j) P/ @/ [! f5 @2 S1 {5 a0 _
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    & `5 D% S. L, f7 j! F
  67. " G' ~' B+ |/ X6 p$ A1 G: y) g
  68. dma_addr_t dmaphyssrc1 = 0;% Z2 \; [7 }- v
  69. dma_addr_t dmaphyssrc2 = 0;
    3 ]4 c% g  |: q4 }7 }0 q, o! B+ I
  70. dma_addr_t dmaphysdest1 = 0;! o% \8 b$ P5 a2 c; t. \
  71. dma_addr_t dmaphysdest2 = 0;
    ' ?& n) |3 G5 t( k, X: T8 j

  72. ; V' O+ I8 q2 m* S
  73. char *dmabufsrc1 = NULL;
    * ?  b3 n. ?# V3 d* C
  74. char *dmabufsrc2 = NULL;) x  l1 Z# g" c! G. E
  75. char *dmabufdest1 = NULL;' X3 a; g5 b( a" k9 T$ L. u
  76. char *dmabufdest2 = NULL;5 I! G* A& e1 H: _
  77. , ]; _+ {  a7 w$ E& V
  78. static int acnt = 512;* r7 s" q8 e4 t* g' C, O
  79. static int bcnt = 8;
    " G7 I/ \- D3 w; P1 f3 T
  80. static int ccnt = 8;
    ! v, J; Q% \* [7 E% ?$ Z

  81. ! Z' {; m" Y1 z
  82. module_param(acnt, int, S_IRUGO);$ k! J. v  ^* h8 `/ k+ \( M
  83. module_param(bcnt, int, S_IRUGO);
    0 x' o0 H) U  N3 a9 g& g
  84. module_param(ccnt, int, S_IRUGO);
复制代码
6 q' k; Y! [4 W5 j

& v) r! o# }- h0 f" {      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
! X. T! s) g: z& E7 w1 a- I7 Xarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
+ c  \9 i' X; o     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。: H7 W) I/ V! l& H9 o. ~# u

8 A( [' B+ w& s9 }: R, o
$ I) o0 q, F: U, W  L
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-4-22 21:49 , Processed in 0.045334 second(s), 28 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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