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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 $ m" g' S1 @3 D  [
  1. [code]EDMA sample test application
    # u3 P* K( u  V) u' R# l/ D: p
  2. /*
    " |" ]/ }% Z1 W6 O9 a
  3. * edma_test.c
    $ \/ L2 ~- D1 a/ l5 Z: o
  4. ** y+ M4 j! c  l
  5. * brief  EDMA3 Test Application% A! u8 v4 z* |. X! G1 u  S1 h: D
  6. *
    % d. p' \$ b% r' H) T* a9 `
  7. *   This file contains EDMA3 Test code.
    ' U' Z' w9 w$ @, W! Y
  8. *
    3 g7 d3 f# @2 y& O0 W( F+ ]0 K/ y
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE9 G1 z& j% ~' M6 [6 T4 l
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    3 ]  p* C8 P2 f8 `, }  X
  11. *         TO CHANGE.
      k' b6 d, l; w6 K$ l; k' Y
  12. *  N! M. \# W4 M2 S
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    6 P1 T9 Y0 J( B& W* ~( a" L# ]9 e# K
  14. *
    : }* t- z: F! E: T" u
  15. * This program is free software; you can redistribute it and/or  C0 X% o2 K$ `7 Y4 @0 v
  16. * modify it under the terms of the GNU General Public License as4 r" \  g( H) p# u
  17. * published by the Free Software Foundation version 2.  v+ d+ M' p, T1 _
  18. *
    - b/ y) {# p! F, ]. \$ o
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any; b9 ~0 S, L6 M4 U) Z8 Z  y
  20. * kind, whether express or implied; without even the implied warranty. w: C4 |7 p8 Y2 `0 ?" i* x# Z
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the. u8 g6 u* g$ W8 _
  22. * GNU General Public License for more details.
    8 p) U' Z. E8 L; C
  23. */
    $ P3 b# [6 t0 C7 o
  24. ' H2 ~  b; r% `' T% D" i
  25. #include <linux/module.h>
    : b( z" m$ U0 i. S
  26. #include <linux/init.h>' K0 q3 z! G- ~; g! \3 {! u; L
  27. #include <linux/errno.h>
    0 ?. {7 ]; I9 B7 O
  28. #include <linux/types.h>+ R* I2 G1 Q0 {& S  j
  29. #include <linux/interrupt.h>
    % U& K1 A% h) K$ ]/ y: x( S
  30. #include <asm/io.h>; y% O" M# Q* k  v% l
  31. #include <linux/moduleparam.h>
    4 i5 [4 S. o3 O1 P  ~$ U
  32. #include <linux/sysctl.h>
    $ f% N" ^% J, m$ S: L4 t
  33. #include <linux/mm.h>& Z% {: V" }" U+ n8 ]8 p: p6 F
  34. #include <linux/dma-mapping.h># m# o4 \0 }. ~
  35. 9 t& S0 U- ~4 |! A, D$ Q
  36. #include <mach/memory.h>
    4 m* t% O5 L. B! J! W/ `
  37. #include <mach/hardware.h>7 W4 }7 T- s! j- Z4 {4 ^
  38. #include <mach/irqs.h>
    9 B$ @) L; v# G8 m: x% e& ^: n
  39. #include <asm/hardware/edma.h>. I6 d! V$ T3 R0 E1 S$ o

  40. : Z  n% R$ V0 Q
  41. #undef EDMA3_DEBUG7 ]3 W3 ?5 e/ W
  42. /*#define EDMA3_DEBUG*// t& y8 q$ n- p5 O8 g

  43. 8 l: z2 M! B: H) F5 J
  44. #ifdef EDMA3_DEBUG
    4 l& M& b8 m1 y$ z* D6 [
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)/ W' U1 O' @: p+ @% k' g' \
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)/ u% @- ]- F+ S+ |
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)4 Q3 [5 o3 o, M7 {) o
  48. #else/ \+ {+ x7 j2 U  u/ A8 l) X: `( L
  49. #define DMA_PRINTK( x... ). @# y7 s, S$ U. m3 e
  50. #define DMA_FN_IN
    2 v" F0 i: a5 `. m/ V
  51. #define DMA_FN_OUT
    9 E) n. v8 _) n' s
  52. #endif
    / A( V0 o7 O! ?: ~0 W
  53. 4 h3 k: t1 Z" V6 b
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)& }* X% {9 v' ?1 @6 G6 c4 D4 |
  55. #define STATIC_SHIFT                3
      v$ d( k2 v9 [8 ^3 L# a, O
  56. #define TCINTEN_SHIFT               20
    ; J/ G) J9 N9 G  q+ O. }
  57. #define ITCINTEN_SHIFT              21
    % \7 @8 F  j+ a& f9 E  v
  58. #define TCCHEN_SHIFT                22
    # o; _! F9 e  i- s! T
  59. #define ITCCHEN_SHIFT               235 r3 X5 |6 }9 K/ `9 Q
  60. 7 }: {3 o3 @+ ^6 e& h6 _
  61. static volatile int irqraised1 = 0;
    ; A/ ~3 @: D2 y* W  G, C
  62. static volatile int irqraised2 = 0;! {( q9 _/ @* W
  63. / b' @" J  @" k
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    2 p: Q# _+ M, m5 J
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);! a- b4 H- \  {( R3 k9 H/ Z* f
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    # i$ G$ e$ }1 O- [6 h
  67. ; P( }% o+ F; a0 D* o! D6 `) n
  68. dma_addr_t dmaphyssrc1 = 0;
    4 M6 I8 G) F4 M* T  a5 s" x
  69. dma_addr_t dmaphyssrc2 = 0;
    $ D3 g+ R" K7 B8 m# w
  70. dma_addr_t dmaphysdest1 = 0;
    ( f3 b! E1 t+ R; G' ~1 q
  71. dma_addr_t dmaphysdest2 = 0;" |7 z7 p/ P# p7 F; d% V
  72. 9 B1 s' c! d' @( ~# ~+ o
  73. char *dmabufsrc1 = NULL;
    # P/ c; H* z7 \) g2 N
  74. char *dmabufsrc2 = NULL;
    9 C* S0 j/ X2 T1 ~! ^( f! F
  75. char *dmabufdest1 = NULL;
    1 n0 o$ T. ^0 |, H+ ?
  76. char *dmabufdest2 = NULL;; l7 @1 ^5 A& R% z7 y- c. Y' J

  77. : i% D2 S. i- I: x+ h8 v
  78. static int acnt = 512;+ N+ u( M' N8 B. X
  79. static int bcnt = 8;
    ; |0 n. D9 X$ R0 x
  80. static int ccnt = 8;4 F$ t- W" ^: S$ {" b

  81. ! U( z6 I/ ~( K; ]9 g7 D) z* P* b8 n
  82. module_param(acnt, int, S_IRUGO);$ `; ~  N$ D5 [& F7 ^  Q& X; R
  83. module_param(bcnt, int, S_IRUGO);
    ) |' P. Y3 y( l. `4 J
  84. module_param(ccnt, int, S_IRUGO);
复制代码
0 U. Y# c! a+ B/ v

2 ^# S  W# g- L; |  V! n7 s2 L3 s, J8 B      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
% x/ O1 \" b. _9 Iarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
/ A. P9 C3 p$ `5 d     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。% K$ E  [9 N8 l& h5 N, z2 g

4 B" j5 Q1 X. U7 q- b: s2 f# N# M7 g# f6 ^% y: h! r" F
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-3-5 21:40 , Processed in 0.039038 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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