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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
( \; ~- S) L2 A- f5 Z# @8 C! ~( {/ `
  1. [code]EDMA sample test application
    6 C2 s# f, I; E$ W
  2. /*
    0 z& [) u: [) v& d7 k+ L6 p
  3. * edma_test.c# b+ a. y3 L7 Z4 U9 H
  4. *
    . C( B0 ^5 j# \, ^' Q* m/ s9 g
  5. * brief  EDMA3 Test Application) d! D* t- Z( W& t7 w. _. ^
  6. *3 N" V0 [1 E3 y! t! s+ I4 e
  7. *   This file contains EDMA3 Test code.
    6 {" q' S" ^6 B* F' p6 w
  8. *) y( m) V5 @  K- H9 ~. h$ o4 q
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE* [% [# o. S3 \, t+ |' A
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    ' T1 E- o$ j* ]( ?
  11. *         TO CHANGE.% ]& M; F* I- R4 ?
  12. */ O1 F$ Q3 t0 @
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    ' |  Z0 h# z' Z) X
  14. *
    . v8 j+ F/ R" j3 ?
  15. * This program is free software; you can redistribute it and/or- c2 E9 Z0 @5 ^- p7 O0 D+ i' V& b
  16. * modify it under the terms of the GNU General Public License as
    - a5 {% `2 ^- i1 {8 h
  17. * published by the Free Software Foundation version 2.( h4 g# X1 q) O7 q; }. `
  18. *9 O! o9 A+ O( p8 h/ [3 I
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    " ^0 {7 f, T5 M; R7 J
  20. * kind, whether express or implied; without even the implied warranty
    5 A& b; A+ I) G; G
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    $ d+ I) j% t. a2 m- n. f
  22. * GNU General Public License for more details.
    1 N  M: s4 c! {: R2 b, n
  23. */% o' e4 V' H- O2 |, b2 V

  24. 1 u$ ?8 b1 D8 t9 |& n
  25. #include <linux/module.h>. \" k3 L) v( f, E3 M
  26. #include <linux/init.h>
    . {  w  D2 n) b6 f! I, Q
  27. #include <linux/errno.h>
    / N+ x  u4 W6 ~+ a" W+ {& I
  28. #include <linux/types.h>2 s# R* U% g; c* I& k
  29. #include <linux/interrupt.h>
    ) V& P& Z7 T6 }' Y8 `. n- g- c* L( x
  30. #include <asm/io.h>
    ' \% `9 r! G4 v, G. ~4 N: @
  31. #include <linux/moduleparam.h>
    # Z) o% Y3 ~' Y' N- c* P/ v
  32. #include <linux/sysctl.h>
    9 H. H1 Z% ^* O! K3 o
  33. #include <linux/mm.h>! t, c& Z9 b% i" x
  34. #include <linux/dma-mapping.h>
    2 x8 [% ^; \, O1 W% _
  35. % p) Z: _7 \1 k# `
  36. #include <mach/memory.h>
    5 h9 V4 W$ t" `( y& B; d
  37. #include <mach/hardware.h>/ G6 b1 g5 E3 O
  38. #include <mach/irqs.h>
    & I/ V+ i8 i- J6 C
  39. #include <asm/hardware/edma.h>
    , G2 [$ t& \( v6 l9 {
  40. $ G# r+ W( X* l: u4 \* m
  41. #undef EDMA3_DEBUG
    7 N7 R4 k: I  f% m+ N( |# d: k1 O7 y" s
  42. /*#define EDMA3_DEBUG*/
    $ t* R* S  s1 o4 ~3 \
  43. 3 A1 z* T; k/ v1 p0 ^; }
  44. #ifdef EDMA3_DEBUG+ Q6 R8 |; v0 Q# v& a! q) n9 D
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    ) X; O) v1 N* D1 Q
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    7 c3 W3 z- ^" D/ e: _& E
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)' d* m5 i. Z) f0 A: L' _6 A4 P4 ^
  48. #else8 E" I! g; W4 T4 d# [
  49. #define DMA_PRINTK( x... )+ j: q3 x1 K3 r7 x0 K
  50. #define DMA_FN_IN
      m) @, _4 v9 e: v
  51. #define DMA_FN_OUT
    - X! I& J% r) V$ c3 s. f* Z/ S
  52. #endif$ S  `5 A1 y* _

  53. 2 D' n& m1 [1 \  `6 v
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)  ?8 S7 q( c: p/ {$ W# {7 I
  55. #define STATIC_SHIFT                3
    5 |2 g: j: _3 u3 i( m" V
  56. #define TCINTEN_SHIFT               20
    ; k4 ]6 L2 v7 {9 e5 @
  57. #define ITCINTEN_SHIFT              211 w5 _* U  k  R# Z& }7 }/ a
  58. #define TCCHEN_SHIFT                22
    5 ^% C6 x  X0 c6 P, r  o" V& j; L
  59. #define ITCCHEN_SHIFT               238 R8 B5 a% |  g6 V9 R

  60. ) g0 m  u8 o, N; h& I7 ^6 `, b
  61. static volatile int irqraised1 = 0;/ y1 Z8 u8 c: n2 c2 b
  62. static volatile int irqraised2 = 0;
    % l- h5 c7 Z  N. T4 Y& X' [! d- m

  63. - g+ L. ~4 q) }+ T
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);( B5 M. R, R2 f. s5 c
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    , r4 ?- q! a) r# b& ]
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);  }% v/ P- G/ t0 V2 _; j! c7 M  @
  67. " ^, k( ^( N3 q4 |+ ~* y5 ?) y1 v2 m
  68. dma_addr_t dmaphyssrc1 = 0;% r! o. o' E8 j$ R
  69. dma_addr_t dmaphyssrc2 = 0;" f7 ]- ?5 G, o& A0 w0 _( \- j
  70. dma_addr_t dmaphysdest1 = 0;4 a7 Q3 |3 }0 x2 j
  71. dma_addr_t dmaphysdest2 = 0;
    7 Y( }/ w, X) J
  72. % ]3 ?7 z: u3 Q( K  S; c
  73. char *dmabufsrc1 = NULL;$ `9 J+ v7 }+ D' \# I
  74. char *dmabufsrc2 = NULL;
      Q. C- x+ e8 @$ c- j3 f
  75. char *dmabufdest1 = NULL;
    8 u' W$ W2 X" R$ l# P4 D( D
  76. char *dmabufdest2 = NULL;
    ! [- d3 G! C$ \! T
  77. # d$ `, v  w5 f$ a3 J% I4 P
  78. static int acnt = 512;* {2 {- }) O' M% z8 I. I
  79. static int bcnt = 8;8 g. O1 _9 a. t0 B
  80. static int ccnt = 8;' U) N- W' v$ H4 n' g* w

  81. 6 {; u5 y+ X/ W7 d1 G; t  z" L
  82. module_param(acnt, int, S_IRUGO);* v0 _7 L% I. v  u' y
  83. module_param(bcnt, int, S_IRUGO);/ a8 J' I( {% A: _% h0 K; w+ T
  84. module_param(ccnt, int, S_IRUGO);
复制代码

: [1 \: C' L& O7 c% m& _- j( Y. g# E& i, v. ]# T& ~. C* R
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用" o! B% ^6 p+ U# f9 ?. m" D
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 E+ ~8 X2 _& L6 {% U$ H& @
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
3 v4 f! J- ]4 [
$ J4 U8 u' U- ?- q
0 N& @+ S; u8 g# @6 q% D$ w7 `1 D
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-1-17 04:15 , Processed in 0.039577 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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