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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 ( I, a5 ?$ H: c. s0 j2 f( X
  1. [code]EDMA sample test application& a) A" V0 x& s% t6 U1 t6 q% n3 C
  2. /*& s5 Y7 C3 f4 v' _% f
  3. * edma_test.c4 S0 s; o$ x+ |
  4. *- E) o6 H/ O4 i! Q1 p
  5. * brief  EDMA3 Test Application5 E! k* k; p% q% S* f( b
  6. *6 ?+ U" \. w1 Q9 }! ^) E3 t
  7. *   This file contains EDMA3 Test code.
    ( a  {  C# E6 j; I
  8. *
    3 ^2 P# {. y& R8 Q9 j
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    ' S3 A$ ?: h( M1 i0 S
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    $ A7 @& v5 L6 P# N7 W6 F: A$ G0 q6 Q2 ]
  11. *         TO CHANGE.) [) G, F& [2 C8 B' `
  12. *
    0 y& @5 O  z& [: Q& d2 |; R: j
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/) T6 Z3 `" u; |& X& j" V- O& x
  14. *
    9 ?9 ~( c7 M# m/ G: t
  15. * This program is free software; you can redistribute it and/or3 [% q# F! f% u8 ~7 H. h
  16. * modify it under the terms of the GNU General Public License as  R7 m3 H6 ?# a6 ^: a
  17. * published by the Free Software Foundation version 2.
    & a' }) i) k+ ~3 ]$ T, }
  18. *
    5 Q, n$ |9 @) r; E; n- S. \/ e
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any5 B6 |3 T& {9 i/ q
  20. * kind, whether express or implied; without even the implied warranty
    $ O( z8 |& D& i) K
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the1 ]; @! C3 j# {/ I% I
  22. * GNU General Public License for more details.
      Y$ w8 e/ D. V9 a, U: p
  23. */" u9 F6 Q& J& t: E3 i3 O

  24. % H2 ]! r% H0 _) u4 I. G9 l
  25. #include <linux/module.h>7 O' K) p  B' c- I) R1 u
  26. #include <linux/init.h>
    - r/ \% d# n7 o
  27. #include <linux/errno.h>
    2 r% ?- ]* D* i/ \
  28. #include <linux/types.h>
    - F: p: y& A/ K5 L
  29. #include <linux/interrupt.h>
    ( K& C8 e$ t6 Y" V1 v: q8 ]+ T; v+ |
  30. #include <asm/io.h>3 V( r' }  n: ?6 W, ?
  31. #include <linux/moduleparam.h>7 V5 w2 n! c- k3 ^9 R
  32. #include <linux/sysctl.h>3 Y6 `$ `) e! q" G: o! C  {( w
  33. #include <linux/mm.h>4 D  D* ^! \& K% A; ]  V7 c4 q4 w
  34. #include <linux/dma-mapping.h>
    6 a/ h$ j2 N/ i

  35. . C' @7 J) B! {3 x
  36. #include <mach/memory.h>
    ) B# `2 d) J  Y+ `" A. U
  37. #include <mach/hardware.h>0 l3 J0 X! w) b8 f$ r  C' \' y$ Q
  38. #include <mach/irqs.h>- n; T  n) m9 P- O, }
  39. #include <asm/hardware/edma.h>7 C1 m# D5 ?, P" u8 D
  40.   H2 E# L% W4 V' z, }) w0 r) B
  41. #undef EDMA3_DEBUG
    % O* [) T- \; }. r5 x9 n+ N
  42. /*#define EDMA3_DEBUG*/
    4 R- t: V* Z* R8 b6 ]
  43. # I7 H% i+ H" A1 b
  44. #ifdef EDMA3_DEBUG; G! E0 x& S* H$ r) e9 u
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)  X' R$ R# H" e& D7 n1 n7 S- [
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    . Z* u4 Q1 l( ]9 D
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__); q) D9 ?0 e9 J  x* Y
  48. #else
    5 o) x7 D% _* I4 K' m5 D
  49. #define DMA_PRINTK( x... ); A; T5 l/ {& R
  50. #define DMA_FN_IN8 s( p- m& `3 F+ X- O! H2 }% F
  51. #define DMA_FN_OUT
    " |  a9 d) N" }7 H& Z- v( e
  52. #endif
    + X7 P. }* d  m& ^: L0 F$ L5 u* a4 P/ t
  53. $ s( s! A! m  E& z4 R3 d
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    ' p& s6 {( \" J9 H- G; z* W
  55. #define STATIC_SHIFT                3  e3 d$ b9 `) e! `
  56. #define TCINTEN_SHIFT               20+ X5 k0 I3 Y7 Z) X4 K( L* S
  57. #define ITCINTEN_SHIFT              21
    / L2 N1 {3 B4 p% u0 i
  58. #define TCCHEN_SHIFT                22
    ) a" A. W  K  I4 ]& P7 Z7 _
  59. #define ITCCHEN_SHIFT               23* V8 v3 _; P4 {7 @2 l
  60. 7 ^- Q7 y- o7 D3 u: K( b
  61. static volatile int irqraised1 = 0;* H/ Y9 b' l5 w" P% ~: |
  62. static volatile int irqraised2 = 0;4 M' I  B# X% N& r* }
  63. 0 t' @) D! M( j0 {
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    4 R3 O  q0 w7 w
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);6 ~, I4 S$ E% N1 ]- ~8 ^3 r. r' m
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);- z# E: Z! e( O% `3 |$ C

  67. ( u2 b, s( R0 g& L: b" R$ K
  68. dma_addr_t dmaphyssrc1 = 0;0 }. M+ [' |1 D) f4 m1 Q) ]
  69. dma_addr_t dmaphyssrc2 = 0;
    , p$ ]' r9 W: x) q# U$ ~
  70. dma_addr_t dmaphysdest1 = 0;
    0 {" f" u. ^; s& f1 Y- m" P
  71. dma_addr_t dmaphysdest2 = 0;3 `! l- T* `6 Q5 L! G

  72. 1 w: b; c+ G1 o% l7 U$ ^
  73. char *dmabufsrc1 = NULL;) W& H  _& p$ P5 L4 e  k" U
  74. char *dmabufsrc2 = NULL;
    % j# w2 V. e0 c
  75. char *dmabufdest1 = NULL;4 \9 \4 j5 |* Y" p' V; h
  76. char *dmabufdest2 = NULL;' T& x- ]! {/ K
  77. / M2 Z* s- i$ q! z
  78. static int acnt = 512;. s+ O' _0 r8 f
  79. static int bcnt = 8;, |! X2 e! X/ U  e$ |; D
  80. static int ccnt = 8;& l/ g& X4 ]$ v3 H
  81. # c7 D0 l. g- T! x" H+ \  Y
  82. module_param(acnt, int, S_IRUGO);8 H( p* c9 F6 j/ E
  83. module_param(bcnt, int, S_IRUGO);1 ^8 P7 e0 c# s- ~9 h4 q0 E
  84. module_param(ccnt, int, S_IRUGO);
复制代码

1 K1 w7 w* V' f) V( ?8 k; @, y5 J+ X
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
2 [, f$ g5 Z4 [) U5 W) Harm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
1 ]$ t& g" ]1 x$ a     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
1 [% l( g5 M: v9 I
+ w' i5 z: }8 Y' A: i) E8 f2 Y, `* W/ s" s: H
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-7-24 10:35 , Processed in 0.042094 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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