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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 ; l/ }8 h% H0 @2 B8 d! X
  1. [code]EDMA sample test application
    " x! y! C% o) W7 A# q5 Y
  2. /*. v; W/ S$ m- i$ z8 A3 \
  3. * edma_test.c, w& L; p: v- M  h
  4. *
    3 ~' a/ v3 _0 w! m/ ]
  5. * brief  EDMA3 Test Application; ?+ t: y9 P& e# M
  6. *
    # X1 |3 E- Q9 C* m4 u% |
  7. *   This file contains EDMA3 Test code." k$ V( J: H0 A# C4 N
  8. *
    $ r6 Q( R) ~1 u
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    & q, ~; O' m. o  i
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    - L6 Z6 k! z: }4 z7 P; V* G& b3 g
  11. *         TO CHANGE.1 C# \+ [1 U/ n
  12. *) ~/ ]8 ~+ w7 _. }
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    - c) r2 j- g$ y0 v! n, @( V! U# H
  14. *. k  `9 g; |% a, [
  15. * This program is free software; you can redistribute it and/or( W4 f4 v* C* R$ N$ ~7 j
  16. * modify it under the terms of the GNU General Public License as, j7 x" l+ B& D) m3 r8 H
  17. * published by the Free Software Foundation version 2.% ~; p* j9 N" N" s, @7 k
  18. *
    4 I$ [( A3 n; ~" K, t6 ~
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any, P' r: V* W( J, x! N; ]* X& f
  20. * kind, whether express or implied; without even the implied warranty) O9 ]5 H' g$ p' F, _# @
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    % r5 ~3 a7 Z* U% a
  22. * GNU General Public License for more details.
    - F. Z8 e& a% Z  P, B, m
  23. */6 l; M; I' F8 a% z& g( F4 U
  24. 6 W8 x; z9 \  s( O
  25. #include <linux/module.h>( t5 L% b" o( A' u
  26. #include <linux/init.h>9 I; t6 B8 O1 B) U' u& y1 q
  27. #include <linux/errno.h>
    ! y4 S/ M' \+ k) g! H7 `+ t# g
  28. #include <linux/types.h>
    1 e# ~: v6 k  Z
  29. #include <linux/interrupt.h>
    3 p0 g2 d+ d! S2 n  l( O
  30. #include <asm/io.h>; Z  V! A# [& J6 u1 D
  31. #include <linux/moduleparam.h>
    - v' U* @3 D. M& |4 l# H$ Q$ r  r
  32. #include <linux/sysctl.h>- g" v/ u$ X' L+ m
  33. #include <linux/mm.h>' |! K# R2 G$ P" I' p/ X! ^2 ?. H
  34. #include <linux/dma-mapping.h>, h$ X) Z% F$ I; B1 W2 h

  35. , M  W$ p) n2 k0 |$ E
  36. #include <mach/memory.h>
    ; [7 o; d4 U; P# I; o
  37. #include <mach/hardware.h>
    1 S4 b" s* p; H8 v
  38. #include <mach/irqs.h>4 p6 ?  {( h$ d+ @$ z/ l/ W0 F0 S1 c* ]1 b
  39. #include <asm/hardware/edma.h>
    ( i/ t0 Q7 Z- r4 t4 D( Z: j

  40. - M9 U) q# B( b* V( p
  41. #undef EDMA3_DEBUG
    ! x2 V6 G! d& }( ]; X8 l0 F: ~
  42. /*#define EDMA3_DEBUG*/
    * G( K; Z- o/ z! B! K& p8 A

  43. # W% W7 I" z6 Y/ T- p: h( H# L1 N
  44. #ifdef EDMA3_DEBUG
    9 h7 W, |% I+ Z8 b$ i
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    & n; O1 j7 ~. ^! `
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)7 ?. L0 U9 i6 E/ ^
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)' l0 m$ L# m6 u1 d. Y& H
  48. #else4 w+ G" f/ Q  V& ~* }7 X
  49. #define DMA_PRINTK( x... )
    8 J( q/ ?% p; E+ ~! l6 G5 d
  50. #define DMA_FN_IN- Q* C. r; A. ]% r9 ]- p
  51. #define DMA_FN_OUT
    " b+ d7 T( v2 j5 ~
  52. #endif
    % A' f$ S8 x8 o

  53. 9 A( D- [9 `2 C5 ?6 g
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)9 a+ x( E1 E* X" v# B
  55. #define STATIC_SHIFT                3
    : V8 _; @6 ?4 ^' f7 N5 V
  56. #define TCINTEN_SHIFT               205 K9 Q4 n- s7 E
  57. #define ITCINTEN_SHIFT              21! c/ B( V6 R; |( d
  58. #define TCCHEN_SHIFT                22
    4 L4 ]+ ]% s+ O3 x; h9 U0 o( [
  59. #define ITCCHEN_SHIFT               23/ s8 w: r8 ^0 O) K# J

  60. 9 M5 \& f+ i5 f% d
  61. static volatile int irqraised1 = 0;
    ( ?  U, z+ b9 @! n5 `
  62. static volatile int irqraised2 = 0;
    / \! N" i# Y* A6 N6 t& j% t
  63.   F, |4 V# U" d: o* Y
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);( O' Z2 m$ n' p' u
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);% H1 V0 [7 I6 L  \# f% J2 z
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    2 n) U3 V1 l& F$ s2 i' j# t

  67. 4 I( \/ [$ Q% }  n& F& O4 @
  68. dma_addr_t dmaphyssrc1 = 0;- r* }  z) J' X3 O! ]
  69. dma_addr_t dmaphyssrc2 = 0;$ l. a, N) m$ H6 Q1 J# n% r  H
  70. dma_addr_t dmaphysdest1 = 0;5 [* Z. T9 _0 c5 G
  71. dma_addr_t dmaphysdest2 = 0;
    & E; o/ n4 d) X3 a5 b

  72. 3 W! b, \2 _/ U9 O  f; ^; [, [
  73. char *dmabufsrc1 = NULL;% V2 n9 j5 U* F  E6 u* Y3 X& L
  74. char *dmabufsrc2 = NULL;+ w: Q, |, y6 l
  75. char *dmabufdest1 = NULL;) ~4 R/ |! N7 o1 C& m6 M
  76. char *dmabufdest2 = NULL;
      _( }" a2 j3 J

  77. - e8 _# O  j' E2 Z3 B. @$ P5 i
  78. static int acnt = 512;
    8 T2 E) f" |8 i$ n! y1 S+ L$ |
  79. static int bcnt = 8;
    6 _' k7 Y  K; f' G( Q
  80. static int ccnt = 8;; c! x4 o2 O+ b( m' S5 g
  81. ; B5 }: l7 |# P9 x
  82. module_param(acnt, int, S_IRUGO);  f  W$ _8 N! D3 [  r6 B5 u% x' p
  83. module_param(bcnt, int, S_IRUGO);
    8 o0 r6 G& H$ o* F* `6 y
  84. module_param(ccnt, int, S_IRUGO);
复制代码

3 F( I$ k. u( `! S7 X  B2 t1 D/ [* H' @- ~9 c
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
0 m: A0 W+ e: Marm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
' }: G+ Y! s4 ^$ N+ X2 Q& U     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
* k6 z& G4 w0 w0 O) {9 ~1 Z
, k1 r; b' H+ ?2 e3 Q0 h0 x8 U9 J% J0 f0 P6 F6 T
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-4-4 10:02 , Processed in 0.040258 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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