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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 4 g. Z2 D. X/ U0 c/ ?% P
  1. [code]EDMA sample test application
    & U. q% ?( C- F* G6 k5 e7 J
  2. /*) ^+ q8 g9 O/ f& `: ?: F" w3 f4 r
  3. * edma_test.c6 P; O# a  x$ e" A2 ^  i& q' c
  4. *
    ) l$ N4 n4 B& d* i( K
  5. * brief  EDMA3 Test Application* Q. Z# e. N. Z+ R9 p' i, N
  6. *! W+ {( X2 |$ I3 k4 s/ C
  7. *   This file contains EDMA3 Test code.
    # g) }- i! p. e3 o$ Z
  8. *
    * D3 V, c$ R" X' `" o7 f
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE- h" W$ f# |0 q! k
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    & B  H5 J0 M% v& b8 a3 c! G9 ~
  11. *         TO CHANGE.' C- k3 i# Y, G  y  L  [9 T
  12. *# h' ?. G4 |% Q6 y2 y
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    : K" e" r1 _3 O( B5 t
  14. *
    & G$ r& S. _4 b3 M$ u
  15. * This program is free software; you can redistribute it and/or
    9 Z( y8 n; y+ b1 G
  16. * modify it under the terms of the GNU General Public License as
    ; C0 a$ \+ O- Q8 L! O3 m
  17. * published by the Free Software Foundation version 2.
    " g. f  T& T) j/ e: w# z, b
  18. *+ @/ {- b- L# X& [0 s
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any( [+ F; C  M( L8 b- o
  20. * kind, whether express or implied; without even the implied warranty
    . {- b) M  P6 P$ b* S0 y0 c9 r
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    6 P  [  R% `3 L2 l4 ?
  22. * GNU General Public License for more details., T& i: x$ @' B2 f* Z2 ^
  23. */
    / n. i7 s0 o: n- o8 @2 `9 O
  24. % V- O# a6 M" n& n* Q4 r
  25. #include <linux/module.h>
    4 ^- d1 B+ _* {( u
  26. #include <linux/init.h>
    3 v( Q3 k% [# O# N& ~
  27. #include <linux/errno.h>
    ' h& r! z2 O- r) G' g# V- [5 m* S
  28. #include <linux/types.h>. T5 n( H/ s4 J  D. j
  29. #include <linux/interrupt.h>9 D' o0 r* B; g+ Y
  30. #include <asm/io.h>
    % U. A: l3 c0 P
  31. #include <linux/moduleparam.h>& g6 \/ D5 L7 Q: d) N4 \( y
  32. #include <linux/sysctl.h>+ X5 q3 b2 Z' a, [1 z
  33. #include <linux/mm.h>2 q, _0 u# X' N# E5 m
  34. #include <linux/dma-mapping.h>
    * t; m" a9 @$ N  k1 C
  35. 2 @0 ?! j' g$ j! p
  36. #include <mach/memory.h>
    0 L9 l! B" {: @% @: M: I* A# G3 F
  37. #include <mach/hardware.h>
    # r  h6 Z5 v! H
  38. #include <mach/irqs.h>. Y8 G! F4 N: t/ L) e: J! |
  39. #include <asm/hardware/edma.h>
    3 n- }; c4 H' j
  40. 6 ]$ T( N9 z$ `7 C) F6 N. V
  41. #undef EDMA3_DEBUG
    7 F, i) t, o* l  R, p( G1 Y7 y' |
  42. /*#define EDMA3_DEBUG*/
    ; H3 k2 y6 d+ k' C$ H1 V

  43. ) `  q1 U4 Q" N$ @$ ~1 s, i
  44. #ifdef EDMA3_DEBUG- i, m7 E2 I0 \+ e* \1 V
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)5 [; U; t. _+ |2 x
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)9 X6 x/ q/ b6 |: h4 h
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    ' @4 c1 Y+ \8 a5 e8 k
  48. #else
    * [5 Z4 X0 y/ e1 W% Y/ ~) g0 n
  49. #define DMA_PRINTK( x... )
    ; p8 d/ E: A3 ?$ T9 h
  50. #define DMA_FN_IN" L2 _; u' F( J" y' F
  51. #define DMA_FN_OUT
    2 X; f# l& A# X4 H0 b8 v
  52. #endif5 ]9 u0 g: Z  P+ T9 S
  53. $ h2 e0 O) j- S- B5 ?0 I
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    1 V! B! n7 q5 H  E* ~3 ?5 {
  55. #define STATIC_SHIFT                3
    8 k+ m5 J6 v" i) L7 g* F, ]; s. W
  56. #define TCINTEN_SHIFT               20
    + Z4 W- H4 n8 t5 z
  57. #define ITCINTEN_SHIFT              21' X4 Q2 B  E; ]- Q! g
  58. #define TCCHEN_SHIFT                22
    - i) }) S+ e/ y' M8 `
  59. #define ITCCHEN_SHIFT               23# ^" y. c6 ]$ D" r" t, ^

  60. 0 A! @$ Y1 T2 S
  61. static volatile int irqraised1 = 0;, R$ f$ z5 L2 ~/ C8 T
  62. static volatile int irqraised2 = 0;
    + P5 [" \( C; X0 [2 b& j
  63. , i" V# X: L, `3 p# q" ?
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);$ v) I; U. w/ l' z  g
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    5 @! k: N. z. V' X2 E. h* {
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);  W6 w0 Q* K/ E/ [% q
  67. * m9 q- D" Z6 ~
  68. dma_addr_t dmaphyssrc1 = 0;
    1 o( M* ?: d1 ~- t) m
  69. dma_addr_t dmaphyssrc2 = 0;5 {( X! ?2 v" h$ `. h
  70. dma_addr_t dmaphysdest1 = 0;8 @7 b6 i+ r# _/ b; e: Q8 r$ t+ ^
  71. dma_addr_t dmaphysdest2 = 0;& P) f  a9 q+ P2 X& g$ H

  72. - D; C) C! a# i3 _  X
  73. char *dmabufsrc1 = NULL;
    & T$ I' D  M! C7 S3 [
  74. char *dmabufsrc2 = NULL;- A0 A  d$ Y1 w. K1 j
  75. char *dmabufdest1 = NULL;
    : G* N8 r% [/ A. P, [$ ?4 c6 I
  76. char *dmabufdest2 = NULL;
    8 j0 ]$ i% f# q% r' t( h

  77. ' J9 D( r6 o3 E& V, |( |
  78. static int acnt = 512;
      G* D# z/ H! T
  79. static int bcnt = 8;
    2 X8 j' Z. z: p# A5 ^$ M* o$ K. Z
  80. static int ccnt = 8;, y/ i: J. t# l4 Y
  81. " ~% c8 V4 U1 S2 Y- E( @
  82. module_param(acnt, int, S_IRUGO);
    8 \/ B! y1 N+ z2 z  y; H
  83. module_param(bcnt, int, S_IRUGO);5 e4 m6 ?( f: h3 H8 h- ^
  84. module_param(ccnt, int, S_IRUGO);
复制代码
7 v1 @0 s0 f+ z; c
- E, p4 U- x+ N1 i2 a5 s
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
5 W# L6 y6 E3 s% x, }9 Farm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。2 w- |  d' Z) k; A1 i! l. s( d
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。  w+ f: t7 \$ r0 G
6 T, ?. q( i6 U5 |. f7 g

% p; H/ ?9 _. a) v( p- h
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-3-5 13:22 , Processed in 0.040778 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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