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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 / W' `, n( h2 K' x7 w! d; t
  1. [code]EDMA sample test application: p( m( @3 }# U4 `' u& _" q0 R( G
  2. /*
    & ?: c6 X2 ~- q* W. N
  3. * edma_test.c
    7 {% C: b, S* `( Y4 w# R9 V
  4. *
    # c8 ~) f  Z* `, |
  5. * brief  EDMA3 Test Application1 S' d7 D- {/ [3 d$ Q: J! h+ X
  6. *
    : Q# b  v* X  t( j6 I
  7. *   This file contains EDMA3 Test code.' u+ M& l4 V" F& \
  8. *# `" L, u. n+ m
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE% N  t. \* k5 w# D
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    , i- l' u; p- `
  11. *         TO CHANGE.. K& `3 a0 |, r& o! A- u" v
  12. *
    : E7 x1 ]" R) w' s$ V" D+ Q
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    ) Y1 N  ?- g  E% D: e
  14. *6 a6 O) E( p5 P% d/ e
  15. * This program is free software; you can redistribute it and/or
    " W9 E! T" O9 w! Y0 D' z* e+ H
  16. * modify it under the terms of the GNU General Public License as1 N( ~( A% ], K
  17. * published by the Free Software Foundation version 2.( s5 B/ w( {1 m) ^+ X- G! F
  18. *
      F8 }8 n7 {/ F; F
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any6 M: T& q5 r7 S
  20. * kind, whether express or implied; without even the implied warranty
    6 N3 a2 T. T/ F- P$ m4 Y1 U
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the: r# L1 \6 U# F
  22. * GNU General Public License for more details.
    - [" }7 z  M! P* g" V
  23. */
    ' X6 q# a1 c5 g2 T( r3 J) m# z
  24. ; c+ d9 N# u/ n
  25. #include <linux/module.h>2 i; |8 A6 f  o
  26. #include <linux/init.h>5 S0 W; D% x" U! a, s
  27. #include <linux/errno.h>9 ^6 p$ ?; I) G8 q5 }' g( c: \! h% Q
  28. #include <linux/types.h>$ |; A! ]# q3 _( D( S
  29. #include <linux/interrupt.h>
    - f7 z. `4 Z  \5 ?: C$ p
  30. #include <asm/io.h>  ]1 W* n# T! h+ t
  31. #include <linux/moduleparam.h>( [# ~9 {( @) j4 [
  32. #include <linux/sysctl.h>
    6 ?& ^& F  {3 G
  33. #include <linux/mm.h>5 q, X( r' |6 B/ c
  34. #include <linux/dma-mapping.h>
    4 y1 i) R- V1 s/ r, F' ]3 v8 d

  35. 3 l; I7 `6 r9 Y. R; B
  36. #include <mach/memory.h>2 C1 F& |2 J/ W) |% j; A+ C1 `
  37. #include <mach/hardware.h>
    ' }% M# `$ U/ q& Z
  38. #include <mach/irqs.h>
    0 P7 ]$ s$ o* e) Z5 }* y
  39. #include <asm/hardware/edma.h>2 k; }+ i" o" f" o5 s, g
  40. $ |, @1 K; X7 d' M2 t( g+ r* s
  41. #undef EDMA3_DEBUG
    % o) O$ B7 g! i6 ^4 c" ~( `: b! r
  42. /*#define EDMA3_DEBUG*/7 F8 o0 y: p" y1 c4 q0 ~% S3 ^
  43. & {1 `: t8 ], o  `. _" n
  44. #ifdef EDMA3_DEBUG2 j& B4 y# {3 a' V4 B% o
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)) y+ s# ~7 `1 `9 d9 D& c
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    8 ]/ @# Y2 ^8 K4 M
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)% N6 i/ D: e% {- X2 I7 T% G
  48. #else% D2 p0 d" V" i( l' l
  49. #define DMA_PRINTK( x... )2 Q8 h  I* W7 [9 l1 r% K
  50. #define DMA_FN_IN
    4 t: R; b, j& E- Q+ w
  51. #define DMA_FN_OUT( L: s/ X' c/ d  v3 u8 C! U
  52. #endif  d7 B3 I( j' j1 D) R0 b+ x

  53. 0 k$ `' ]& b# D( d: j
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)4 t4 E/ k( |. R
  55. #define STATIC_SHIFT                3, P& a  C; D% f9 `, D- ]- C- K
  56. #define TCINTEN_SHIFT               20
    9 h$ q6 G. K0 \' H
  57. #define ITCINTEN_SHIFT              21
    , y. X: V( s$ L6 m4 x. `! z
  58. #define TCCHEN_SHIFT                22( n& u3 o$ u$ Y" ]
  59. #define ITCCHEN_SHIFT               23
    3 j" L/ a! \. l) o3 Y2 Z! i

  60. & r( R0 p" w. n3 ?4 C5 \5 D
  61. static volatile int irqraised1 = 0;
    ) }; d3 i2 y0 u7 E# O
  62. static volatile int irqraised2 = 0;
    + w  h; C3 c5 S7 q' [; m
  63. 0 c. m# C/ w/ D7 P- M$ Q
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ; x2 _6 }& \4 F8 h0 m
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    & o4 ?3 U2 J' l, H( l5 s; `* g
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);4 v+ ~1 {8 o) S0 j: A

  67. - ?, W! F9 f/ V4 J
  68. dma_addr_t dmaphyssrc1 = 0;/ Q! `% S5 v! O' _
  69. dma_addr_t dmaphyssrc2 = 0;$ `+ f- i( N+ m7 C) G  j
  70. dma_addr_t dmaphysdest1 = 0;
    % u. G8 A& Y0 S& A. @$ \- M
  71. dma_addr_t dmaphysdest2 = 0;& {9 ?0 S' @  x% k' ^5 U7 p/ E9 Z

  72. & @5 m  F2 t; d# k% e1 N
  73. char *dmabufsrc1 = NULL;7 ?! a2 Z( I% U% `5 R5 N# [
  74. char *dmabufsrc2 = NULL;, r$ w3 ^8 g0 A3 ^
  75. char *dmabufdest1 = NULL;
    2 x- l( R/ ]) Y2 w# Z$ i- f# B
  76. char *dmabufdest2 = NULL;& f- |( L2 \/ j
  77. ; _9 @# h& u5 R
  78. static int acnt = 512;
    7 L& b; R: r4 q; n) ]. H% r
  79. static int bcnt = 8;) @& k: Z& \6 R+ h
  80. static int ccnt = 8;& u0 R3 D3 ?8 m( g: h: H
  81. 8 y4 U5 F5 O0 n$ G: f+ D+ s6 r
  82. module_param(acnt, int, S_IRUGO);
    ; {7 {2 T4 c9 z
  83. module_param(bcnt, int, S_IRUGO);  P% w1 l- v6 S( C$ X& _7 S9 z
  84. module_param(ccnt, int, S_IRUGO);
复制代码
  p2 i/ Z! q/ X9 {

) F* F" \$ g/ D      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
) ~' [; [+ h. U8 i* k, }- Uarm-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# m9 t1 V9 ]     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。( J  P1 A) L/ n7 y8 z/ B' F
9 P; U, o& [/ I& E; @8 r
2 F6 f' A! v" T4 ~! b. M
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-2-4 11:51 , Processed in 0.040827 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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