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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |正序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 " U  z: k, K/ [' |
  1. [code]EDMA sample test application
    : N8 P: i$ I: `7 v( M2 G& l7 z
  2. /*
    # f& c+ D, a" V- S
  3. * edma_test.c7 Z- S% }$ w- x) _& j- `0 [$ m2 Z2 l
  4. *% H; W) T$ Y/ [3 p+ O
  5. * brief  EDMA3 Test Application
    2 @! m" F2 F9 A$ S3 K
  6. *
    * D. E3 U" F8 E7 h/ V8 S
  7. *   This file contains EDMA3 Test code.9 B# `; H9 \6 c0 \% F2 M
  8. *
    , c- G" y; e" _; l
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE+ Q' ~1 D+ y/ Y4 w
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT7 M9 K0 u" E7 s
  11. *         TO CHANGE." ]& Q1 I- f& O6 j, J6 o
  12. *) D3 l  C$ B( L$ Y
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/( k) r2 t) j: y7 i' C# `/ E
  14. *% X) r4 J1 m7 D" k, N
  15. * This program is free software; you can redistribute it and/or
    ' J# K9 x, P2 r. _
  16. * modify it under the terms of the GNU General Public License as
    : J( X; Q$ [8 f3 a! O3 q1 m: v. O4 ~
  17. * published by the Free Software Foundation version 2.8 j! x( v9 N& l& X6 i
  18. *% X9 R  J7 _. O- Y
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    0 |7 ~' Y7 w6 a) C
  20. * kind, whether express or implied; without even the implied warranty
    - S- g& }% f6 H1 ?( [
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the4 u+ ~# w6 c% {" @$ t
  22. * GNU General Public License for more details.
    ! ~" [6 ^. ~2 L% q
  23. */0 N3 H, z  i. l) v4 [( x7 w/ _% R
  24. % p& }! E. T- g8 {/ I7 c
  25. #include <linux/module.h>
    6 S1 m; g5 Z$ n  `3 z
  26. #include <linux/init.h>- i9 J9 T: N/ s% X2 c
  27. #include <linux/errno.h>
    # V4 _* n/ e& N! x
  28. #include <linux/types.h>
    2 T) V- F' s( G. ~, A: L: T
  29. #include <linux/interrupt.h>: m7 p3 v0 |, z$ D
  30. #include <asm/io.h>
    ! c4 B: P) T1 }0 c3 o: {
  31. #include <linux/moduleparam.h>8 z4 f8 t* ?% w# b0 n5 l; k
  32. #include <linux/sysctl.h>
    * D% Y; x! s+ ?5 M+ h
  33. #include <linux/mm.h>
    8 W3 T& ]; L. w( F7 l$ P
  34. #include <linux/dma-mapping.h>
    , g, l2 O  {' S# `' f
  35. ; s% U" W" q9 ?
  36. #include <mach/memory.h>
    / ~# Y7 H: [6 S9 _  Y% w
  37. #include <mach/hardware.h>1 p& @9 s( ~! A& {
  38. #include <mach/irqs.h>( N3 Q! |$ q# a
  39. #include <asm/hardware/edma.h>
    / e3 l2 G% c2 Z& I$ _, `0 I6 @
  40. 7 Y; P( O7 Y6 r# q6 q6 Q* k
  41. #undef EDMA3_DEBUG- M( t2 Y" u& z3 m1 }$ |
  42. /*#define EDMA3_DEBUG*/
    ( J; X/ V) u; @6 o  [' f- c
  43. 2 ^# H& P3 k9 b5 Y! z$ a8 J  R- Y
  44. #ifdef EDMA3_DEBUG
    7 h; H5 j( \/ k' f
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)% E$ P4 H" d0 G  \
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)  ^3 ?+ S3 X6 y! H# q' u& l
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    ( C9 o, V& S8 s; r, r
  48. #else4 ?! `  X4 w, l: V3 g; r' X/ e
  49. #define DMA_PRINTK( x... )& A. V. k$ k# U9 X7 I
  50. #define DMA_FN_IN. E$ b1 p0 r! D8 |* m" F4 d' D
  51. #define DMA_FN_OUT
    8 _1 l9 n, A3 S  g6 V* O8 b
  52. #endif# o! k, t/ z' T7 p3 G

  53. 5 v: m" t$ d& J% V3 F& G2 Y( k
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    / S6 h2 y3 ^  E
  55. #define STATIC_SHIFT                3
    6 {& u9 K. x+ z/ ^( w; u
  56. #define TCINTEN_SHIFT               20
    4 h/ j" A8 K8 z# d2 d
  57. #define ITCINTEN_SHIFT              219 f% i" A) |: J& L8 ^# f0 s
  58. #define TCCHEN_SHIFT                22
    * Q$ \  A0 z+ K) M
  59. #define ITCCHEN_SHIFT               23
      t& h8 G+ @& j( {
  60. , V; p+ m% m* }9 H( w- E; F0 F  U
  61. static volatile int irqraised1 = 0;& Y! d& l4 Q' H$ ]0 H, J
  62. static volatile int irqraised2 = 0;
    9 A, s. ^! M" Q( p6 ^2 Y* M  f. F
  63.   E7 e8 P/ [; O" i5 [6 u6 |$ U' f
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    2 _( y5 ]5 J: a1 ~1 q
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);( T8 Z; u  v) c% u! s5 |
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    " H! l6 |+ s6 o) c- F. T
  67. ) E7 p$ E3 W  ]
  68. dma_addr_t dmaphyssrc1 = 0;, M4 @! g' v4 N1 E+ \
  69. dma_addr_t dmaphyssrc2 = 0;" Q7 n. a# @, b
  70. dma_addr_t dmaphysdest1 = 0;
    8 j6 E( m8 b& ?7 w- m* l
  71. dma_addr_t dmaphysdest2 = 0;
    . r* M- J4 b# x# K6 B4 }
  72. * _# V' E2 H$ F+ B
  73. char *dmabufsrc1 = NULL;% S; s' g( T" m) }0 e3 O. h
  74. char *dmabufsrc2 = NULL;& v0 ~; V! {. K) S5 r$ _. S' ~
  75. char *dmabufdest1 = NULL;
    - b' `6 C1 U  c1 R7 x7 J
  76. char *dmabufdest2 = NULL;, U" L  N, }; a
  77. # ]5 j! O. f/ y9 O' f1 G% v( V
  78. static int acnt = 512;
    4 s( @5 e9 P; b0 z# m
  79. static int bcnt = 8;+ P: d: Y8 i& ^8 n' G
  80. static int ccnt = 8;# S, x1 `4 y, v& l

  81. ) B  j% ~, Q" n; d9 N* a3 d
  82. module_param(acnt, int, S_IRUGO);; ^' |* \  \% I- H
  83. module_param(bcnt, int, S_IRUGO);3 t: {1 B& A, K
  84. module_param(ccnt, int, S_IRUGO);
复制代码
: |* X% R/ l1 e0 f/ ?
5 c* C* P. Q" h3 `7 I
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用$ o' U, M- ]+ [5 ^
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。8 u8 _! {# V, q! y2 b) D7 e
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。, A5 `6 L% f0 t2 L
& h7 T7 W1 S) s% c- [9 b% E9 G
0 \* E* X' m0 M* W; B  I
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-3-7 05:06 , Processed in 0.046817 second(s), 28 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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