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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 1 N8 `, @# A' d+ n+ w% Q
  1. [code]EDMA sample test application2 p4 A- {+ U) x& y+ b
  2. /*
    ' m4 H4 K/ u6 q4 g
  3. * edma_test.c
    ; o; J2 m, o. L: Y
  4. *0 M) Z4 ^' N# f0 Q" M
  5. * brief  EDMA3 Test Application
    ' M0 D6 B+ T7 C* t; I# U& O. o
  6. *
    8 o$ y: i% e+ G! _9 Q9 i9 d
  7. *   This file contains EDMA3 Test code.* R' H) q- m! ]: |
  8. *
    " z! Z7 X2 J9 o! ]* j2 w9 F
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE% W! o- D8 `' A! F6 ~9 m
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    & P7 u9 w) m# |: {
  11. *         TO CHANGE.
    , V# O) D* o3 B) }. G9 p
  12. *
    / B$ |$ @8 `. `/ M3 p/ G
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/6 ^$ z) G2 v0 D, c, D, b5 Z
  14. *. H. U' Y9 N' E% t' l
  15. * This program is free software; you can redistribute it and/or
    6 _; n/ Z! z8 o0 F8 K
  16. * modify it under the terms of the GNU General Public License as
    * ?& p* i& |- i' C0 Z
  17. * published by the Free Software Foundation version 2.9 Z) B- ^- j* S/ r* Z
  18. *
    % q1 U' `+ H% v
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any+ h  X% ~* x; _4 j5 n
  20. * kind, whether express or implied; without even the implied warranty; [/ [6 K' W% `
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the% f' \2 r6 [& {5 p
  22. * GNU General Public License for more details.
    * d" U2 p; V1 V8 l5 [$ N: `3 l' v
  23. */
    # ~6 {- |0 d2 `: x3 X# w( z

  24. % v# L( m1 M6 f, U* u) E8 v
  25. #include <linux/module.h>6 E2 G# ~2 t" `0 f# R
  26. #include <linux/init.h>
    3 J' R/ X% e! j9 m* C; K
  27. #include <linux/errno.h>
    9 p  s" x2 g! @+ l
  28. #include <linux/types.h>: }$ Q& z# {6 _' |. U0 k
  29. #include <linux/interrupt.h>' y# m7 b; W8 B3 l% H+ \6 s
  30. #include <asm/io.h>
    4 C  ~. u! E# C1 t* W
  31. #include <linux/moduleparam.h>8 t1 [0 f1 Y) ^. L+ h: y
  32. #include <linux/sysctl.h>2 u$ c7 `( w% J
  33. #include <linux/mm.h>
    1 l/ @3 |$ C4 `  j5 B
  34. #include <linux/dma-mapping.h>
    ) D5 E* A8 \9 G
  35. 3 z' |! C; l$ K# m/ n/ t+ y2 t: X0 P
  36. #include <mach/memory.h>
    3 @/ |! L8 e! z+ I& z
  37. #include <mach/hardware.h>
    , l5 N+ Z# [" E
  38. #include <mach/irqs.h>$ o9 }0 s" Z2 m8 i
  39. #include <asm/hardware/edma.h>
    5 _( B# E8 c  q3 `( u
  40. ( c8 i+ C2 A0 v
  41. #undef EDMA3_DEBUG
    4 P% X; n/ x1 j
  42. /*#define EDMA3_DEBUG*/, x! ?* O/ L$ Z

  43. 8 k, L% A. v; U4 ^
  44. #ifdef EDMA3_DEBUG
    3 B# a( F2 s% k$ {* D
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)$ Z3 c& k: j/ M" Z$ d
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)5 m0 G9 u3 n* {( t3 v+ u
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    : s0 x! g; f# b* S
  48. #else
    + L3 f' [, X0 b
  49. #define DMA_PRINTK( x... )/ w: V, ~5 F& q0 F( f! ?' Q9 u
  50. #define DMA_FN_IN
    0 \* v4 r. U' E$ g+ z+ b
  51. #define DMA_FN_OUT$ x5 C" i4 h2 X, Q% q/ x2 [" `! p
  52. #endif
    ( Q" z& u/ J9 h% E
  53. 5 u, \5 E! a- c2 L
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    " M, v) p0 x0 Y$ o) `* V
  55. #define STATIC_SHIFT                3
    7 ~! R* W0 [. ?6 g$ ~1 J- ?
  56. #define TCINTEN_SHIFT               20
    $ _; D1 Y0 K2 Y! A; a, L0 i  n
  57. #define ITCINTEN_SHIFT              21
    6 g. I) E5 k9 m( V5 l: E
  58. #define TCCHEN_SHIFT                22; y* D, J  n0 w
  59. #define ITCCHEN_SHIFT               235 U* G. R( C8 t# X- e
  60. 0 @( X8 p( R/ [! P  d
  61. static volatile int irqraised1 = 0;
    + D5 B) U) x4 f4 u' d
  62. static volatile int irqraised2 = 0;
    * {& ]- M: y( a# `. ~
  63. $ w# w1 Z* T3 v/ K3 {
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);3 v/ [+ t0 Q7 I) i
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);& K2 d3 H' N% ~) i* I6 y" ]7 z
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);- }% r9 u- x0 e* c' J" }. }& ^( ]
  67. ' B+ t  U, E2 X% U9 i# G
  68. dma_addr_t dmaphyssrc1 = 0;4 S. L* v* e' z  O
  69. dma_addr_t dmaphyssrc2 = 0;
    6 d% T/ w& X- ?( Y; E' s
  70. dma_addr_t dmaphysdest1 = 0;
    ) I. T: g/ g1 g  P3 e
  71. dma_addr_t dmaphysdest2 = 0;$ Y: T1 W  |$ y5 C, G/ a7 t' E

  72. : H; H& Z5 M/ H" l
  73. char *dmabufsrc1 = NULL;9 S1 J8 ^# {' Q3 y- c. a2 d( q
  74. char *dmabufsrc2 = NULL;% m" i9 M) I/ v& [9 |1 R& s/ U! o* s6 ~
  75. char *dmabufdest1 = NULL;) p4 ^( w' n# B; t8 G/ g5 N) d3 x, L
  76. char *dmabufdest2 = NULL;& d  c. h# o8 s" z. e. T4 a
  77. % g+ h( t* @2 l  P7 J1 U9 N2 f
  78. static int acnt = 512;
    0 w$ k$ s. U+ N, X3 d
  79. static int bcnt = 8;
    4 M+ \$ B; L5 J1 d$ M5 `
  80. static int ccnt = 8;5 {- I( b. y, G# [) m8 B3 E2 k

  81. 8 \  H5 q( G% q* N
  82. module_param(acnt, int, S_IRUGO);
    ) X4 H. X$ z1 ]2 {7 _
  83. module_param(bcnt, int, S_IRUGO);+ b: I6 u; T& q! u6 m- X
  84. module_param(ccnt, int, S_IRUGO);
复制代码

6 ]( ~  \; k+ R4 e( @" F9 L/ W+ e. c; ~5 m8 m: t% F. a
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用5 j4 j: X. G6 G( N
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。* S. D# y* g! r. c( H
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
  `8 Z, f& {1 A) o# i
4 q1 h- w  w) l4 B  _: v/ R' r9 x; T1 y
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-2-3 10:41 , Processed in 0.039877 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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