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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 ; X) n) ^1 O& Q  i
  1. [code]EDMA sample test application
    3 y  K$ R1 U5 z! @3 F8 @) e& o( T
  2. /*
    " C2 t2 }' G* ]7 [' \
  3. * edma_test.c
    : c: E, V. l& Z$ C6 `( O' @
  4. *6 }. S1 m( O9 _# E. C7 e' a  ]
  5. * brief  EDMA3 Test Application
    / b+ q6 C4 Y4 z' G, `0 n3 ?
  6. *
    + T$ M; J, M( g7 u8 n/ E" J! J
  7. *   This file contains EDMA3 Test code.
    5 i0 x( n, G) a: D' J9 q7 b9 E
  8. *6 |  f% D( g, G! T+ {; \: t7 ]# ~7 r
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    / S5 E9 v4 r' D0 C- B+ j% M
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT$ {1 F/ ?9 S+ A1 u7 c3 x# J% w: o9 D
  11. *         TO CHANGE.3 |! U$ e; U/ g
  12. *. i; T9 a5 q: v' ~# T
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/! T1 _: B% f% \3 w* d; P
  14. *' T; g9 M. J  J' N; [
  15. * This program is free software; you can redistribute it and/or6 y8 e4 y% C8 V/ |/ n
  16. * modify it under the terms of the GNU General Public License as
    ( k. _% K' \" X3 h
  17. * published by the Free Software Foundation version 2.
    & i  Q; H8 W: c1 S1 @& A. ^
  18. *% s7 @6 i. `% X5 P
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any9 W+ E) e: h7 e1 i$ o
  20. * kind, whether express or implied; without even the implied warranty
    7 z3 ^6 B$ z8 Y
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the  b3 ^# r1 e7 ~/ I
  22. * GNU General Public License for more details.
    ) f3 M) H; H$ J/ k, ~4 `- {/ w
  23. *// L6 }- S, W+ f! C# r( P
  24. ' {$ a7 {/ q" T4 Y
  25. #include <linux/module.h>; F/ l5 X! @9 F( N# x  X+ k
  26. #include <linux/init.h>
    5 I: Z1 E% s* f! ]4 p. {8 U
  27. #include <linux/errno.h>
    ; `: \$ x8 x5 k4 v) I- f
  28. #include <linux/types.h>1 {' V. R% z% O4 o3 ]
  29. #include <linux/interrupt.h>
    , R; e3 G+ z" H7 X9 u
  30. #include <asm/io.h>
    " D+ v) z4 X9 o. o
  31. #include <linux/moduleparam.h>
    : r6 K/ x2 T+ M5 j3 Q3 ]
  32. #include <linux/sysctl.h>
    . L9 P. }2 q  l: q
  33. #include <linux/mm.h>9 D- |7 N' }0 v4 U$ R# s
  34. #include <linux/dma-mapping.h>
    - M) E7 O: Q6 F4 L2 G: d7 A
  35. + L% ?" O% h' `
  36. #include <mach/memory.h>; E+ X3 R% \, a6 S! h/ e
  37. #include <mach/hardware.h>0 M% d* W$ z3 e6 Y5 V9 W: a
  38. #include <mach/irqs.h>
    2 Z5 N% d6 g, h6 `- d- }
  39. #include <asm/hardware/edma.h>
    9 o; ]8 d7 T1 W
  40. % P7 T' Q1 B. Y& @- T! d
  41. #undef EDMA3_DEBUG
    + @0 E/ |, L/ Y6 ^4 g, L
  42. /*#define EDMA3_DEBUG*/5 U3 m" r2 E3 _0 x" A- V% Q

  43. # P! C2 K/ l. \/ C1 T1 @3 I
  44. #ifdef EDMA3_DEBUG/ e( n7 K  }1 k: Z
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)4 b. D0 c' Z3 J$ o$ ~
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)! ^6 x, d5 D/ v9 Q9 b
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    4 p) g& e! G, |% [
  48. #else  i/ z4 Y" g8 r4 Z
  49. #define DMA_PRINTK( x... )
    % m( {# m: q8 Y# m
  50. #define DMA_FN_IN" ?' a$ w5 V0 M$ E% j1 g
  51. #define DMA_FN_OUT3 t/ J2 R2 p# U5 |. K  h( V
  52. #endif
    * J" f- p- {3 s7 |, M
  53. ; X, c8 H, W( c) B4 s. k6 I; z
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    6 j  k8 t" t5 C$ B. s
  55. #define STATIC_SHIFT                3% m3 }. S; I/ E7 n  A* C- a
  56. #define TCINTEN_SHIFT               20
    $ q* p% ]2 {/ C# O; U; G
  57. #define ITCINTEN_SHIFT              21; _) r) y1 E% u- `
  58. #define TCCHEN_SHIFT                22
    ! u9 }$ Z6 U9 t( J5 c- P" f  t
  59. #define ITCCHEN_SHIFT               23( V7 m  P8 U7 c/ u- h7 }6 T
  60. 1 H# t7 w* B. T8 k: O& K
  61. static volatile int irqraised1 = 0;  ]/ v7 Q& b+ Y
  62. static volatile int irqraised2 = 0;' l6 d1 O# k% `3 t. n8 C* ^& C
  63. 2 C9 v, @9 ~$ L" L5 u, P" l& V' C
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);4 Z' S; ?1 m* m
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);  @0 R# ?' Q# I* P
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ' t/ n/ a& E4 Y) I3 J) ^6 K) \

  67. 2 Y- c1 D: o' O/ p
  68. dma_addr_t dmaphyssrc1 = 0;) J* J5 B3 f" u) E3 h! X( \& I* E2 S
  69. dma_addr_t dmaphyssrc2 = 0;
    3 e2 m2 [) M/ u
  70. dma_addr_t dmaphysdest1 = 0;
    6 d, p4 F. D% R5 Y  N5 q: J; S9 w7 r6 J
  71. dma_addr_t dmaphysdest2 = 0;
    4 u" \! _; B& G' Z7 k
  72. 3 N' x3 e& H& \# ]% Q
  73. char *dmabufsrc1 = NULL;
    5 q9 u3 m3 d, z
  74. char *dmabufsrc2 = NULL;' S* S; i3 H* k2 o8 m0 z
  75. char *dmabufdest1 = NULL;( `. ^' L2 D/ b6 h6 g9 G7 c/ v& N
  76. char *dmabufdest2 = NULL;4 l- t( z3 a0 I, l, y. K

  77. 8 i( [2 T3 q6 N- y2 i, `. D5 D' r
  78. static int acnt = 512;
    , f. p! N$ c7 N- C' D: k; W  V
  79. static int bcnt = 8;0 C6 |) V0 l+ U6 L. H/ ?- `) Z+ g
  80. static int ccnt = 8;
    4 ]8 U& c" I! r: x7 Z: T9 f" y7 n1 V
  81. 8 a8 ~+ j4 v3 |  `: K1 y1 c
  82. module_param(acnt, int, S_IRUGO);" a% j+ V( n% i9 {" R
  83. module_param(bcnt, int, S_IRUGO);
    - ?. U4 h* @) ~+ C& e
  84. module_param(ccnt, int, S_IRUGO);
复制代码
. U/ c8 f' d2 x3 c

0 I7 {0 C- o: ]# T3 H      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
! u8 m+ p9 H" }5 p1 b' 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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。3 u! }" Q1 K6 a4 s
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
! u# s! K& P+ C2 F% M) D; d  [3 R: f9 R* {, Q9 w! f. a, \) N
. _1 ?6 B6 _; J1 K- y
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-8-22 15:51 , Processed in 0.044599 second(s), 28 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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