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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 ! f0 r6 }5 c6 N2 d- C
  1. [code]EDMA sample test application$ y, v& b3 w- Y( H% M
  2. /*
    7 S/ p1 [) b/ n* \- O
  3. * edma_test.c9 f4 l0 b- M0 i* W! ?
  4. *
    " K$ S$ `1 q  C" Q+ @. ?
  5. * brief  EDMA3 Test Application
    ; g# d! d. w; T  H! j& r  F
  6. *
    + X" Y( q1 J1 g8 H$ g
  7. *   This file contains EDMA3 Test code.0 x7 H* a' i6 I8 h+ j$ v. P
  8. *
    $ N( x: t5 q4 j! y5 S$ s( M# q
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    " a2 D: m( b; y  z0 Z" A
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT7 {6 S3 H5 g9 H# h
  11. *         TO CHANGE.7 D: x: O/ d% M! E' F- A
  12. *
    ' K) w5 w' {7 }  e5 D* r1 d
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/; y' C  y# m' r* Z2 Q4 j
  14. *1 M  l5 S  ?+ f0 T0 p+ Q
  15. * This program is free software; you can redistribute it and/or
    + n# J9 z  S+ N( e. h9 n+ H0 _
  16. * modify it under the terms of the GNU General Public License as
    7 m7 z3 K3 F+ D9 Y2 G. ~
  17. * published by the Free Software Foundation version 2.
    9 C  a, E/ ^' S
  18. *
    " W0 @. S  h9 z3 Z& _8 W
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    # O6 o9 w1 r! H$ T& G/ i
  20. * kind, whether express or implied; without even the implied warranty& O' Y5 _+ k: l0 r8 N# A
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    / ?( ^5 D# i9 g& o- `% I2 O
  22. * GNU General Public License for more details.! {) k% |( i) M$ V  x
  23. */* [, p2 V8 k- S
  24. % a3 ?4 T$ `  e; a& M. D6 _4 o8 r$ d
  25. #include <linux/module.h>- z/ }6 }. I) w) ~! o
  26. #include <linux/init.h>
    ' y0 {2 f" [3 P! P3 U7 M
  27. #include <linux/errno.h>
    / Z6 Z/ p4 w  l: k0 e
  28. #include <linux/types.h>
    , V& T7 |/ o3 ?5 K( A4 x
  29. #include <linux/interrupt.h>
    ; m5 [+ q7 x$ j; {
  30. #include <asm/io.h>
    3 E4 N' ^: @# `6 m1 L; m
  31. #include <linux/moduleparam.h>
    ) N9 i( k* l% m7 m
  32. #include <linux/sysctl.h>/ ~/ `2 y; A+ x- h
  33. #include <linux/mm.h>
    ( F& A9 T5 A/ j/ l; w4 ?' W
  34. #include <linux/dma-mapping.h>
    - U) g+ }  t; U- [7 W

  35. 3 Z5 i0 j; X- i; u5 M7 T
  36. #include <mach/memory.h>0 r" ^7 n/ J! X1 C3 X2 `' ]# _' K
  37. #include <mach/hardware.h>) v4 D' O' b- Y, k7 p* I
  38. #include <mach/irqs.h>
    & B  S; }9 d: q) e
  39. #include <asm/hardware/edma.h>
    ' H6 i( L' S5 Q
  40. 9 y& [& ?# S2 h4 r3 d; l6 o8 |+ a
  41. #undef EDMA3_DEBUG& J7 ^; F2 {+ @+ A4 y8 G
  42. /*#define EDMA3_DEBUG*/* E9 k  O: K: N+ s( e3 q: X

  43. " V1 g7 F) \1 l4 T4 `
  44. #ifdef EDMA3_DEBUG
    4 v- |, R" i, R$ [9 g
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    & ?. k0 v; B8 D1 C- l6 p: k
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)# @" H3 E& [5 ~. b% w
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    + h* C/ Q. s/ W$ e- h! |0 ?
  48. #else
    ( n4 J8 K/ t7 `( e: L8 B
  49. #define DMA_PRINTK( x... )
    1 k. `0 `/ S" n$ h& a
  50. #define DMA_FN_IN5 N$ E( k0 I0 x8 p/ {: k" X
  51. #define DMA_FN_OUT
    2 j" r7 w$ O2 T1 B
  52. #endif
    . x' Q5 c  h4 E# D7 G
  53. 1 [, d+ k& K8 W6 \3 p
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768). U1 `; O, H- s/ y) J
  55. #define STATIC_SHIFT                3
    - o9 A, @0 ?7 K7 F
  56. #define TCINTEN_SHIFT               203 L0 `) A8 }! f& ~. m- v0 S
  57. #define ITCINTEN_SHIFT              21. f3 ^# \9 s) _, g! d* o& G
  58. #define TCCHEN_SHIFT                22
    7 H% v/ E2 p& Y, Z. o* L1 d
  59. #define ITCCHEN_SHIFT               23  H% F, U4 E) p
  60. / T, p1 ^/ g6 X7 M1 l# V
  61. static volatile int irqraised1 = 0;
    ; w4 k1 b. s; I8 x
  62. static volatile int irqraised2 = 0;
    # g/ x* g0 }4 N. M! J* U! N" m3 y# M

  63. ! s; p/ z, x( V& k
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    2 Z; U; x# k8 t+ o
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    6 ~0 [7 _* ^/ d* K5 R8 O
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);; ^4 P' m$ ^' L- t

  67. - N6 P: s- v. ^. M( R8 P  j3 S
  68. dma_addr_t dmaphyssrc1 = 0;
    ' r% n  ?# ^( [. C* L" R2 c8 c
  69. dma_addr_t dmaphyssrc2 = 0;
    7 |, l, T+ Y, X! I/ q  H
  70. dma_addr_t dmaphysdest1 = 0;
    " H. s3 m+ A) j6 }
  71. dma_addr_t dmaphysdest2 = 0;" Y9 O+ O7 V. ~' E- X* R
  72. 4 t, t  v" z/ V. N4 N3 B* s
  73. char *dmabufsrc1 = NULL;. ?/ f4 C1 d8 X, l+ b! ^
  74. char *dmabufsrc2 = NULL;4 H9 g! S' R9 l& r& u& m* P4 b* ~
  75. char *dmabufdest1 = NULL;' M% n4 H$ m3 w+ T4 t4 Z( j
  76. char *dmabufdest2 = NULL;  b: v  c( M  l: S  |2 S
  77. ' O. Z! m6 D1 K3 E
  78. static int acnt = 512;8 |- u3 L, w8 D
  79. static int bcnt = 8;
    6 G( ?1 r9 i% J$ o+ V) Z
  80. static int ccnt = 8;
    7 l" B: q( F+ f4 u' I

  81. ) E6 T6 p) ^! s1 s0 z' e5 o% J
  82. module_param(acnt, int, S_IRUGO);
    $ ?3 R8 \9 X# `
  83. module_param(bcnt, int, S_IRUGO);; ~8 g, Z) A2 Y0 O
  84. module_param(ccnt, int, S_IRUGO);
复制代码
& q7 g6 f! C# u1 m# q, F

; V% w4 V6 M9 f9 C7 e7 X' A: O      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用6 i" J& C% s: _& O* @* {9 Z
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
9 X- d3 n1 A; m! j2 {3 X+ z. W8 D     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。0 U2 t% w  H  T. H( V

& \  q5 H2 T! J+ W9 r; Q' r* V
% q9 ?0 M! o9 I2 y3 N$ w- r/ F
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-2-13 06:36 , Processed in 0.040144 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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