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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
2 i, y! I/ |* ?; X' W. c6 W
  1. [code]EDMA sample test application
    , D9 Z! T/ R) b
  2. /*. h5 r0 K& r" k2 _, h* J) X& F! c
  3. * edma_test.c1 F3 q+ h3 W1 G  y* x
  4. *1 M' Z# z, ^9 H' }- j; ]
  5. * brief  EDMA3 Test Application
    ' V8 A" [5 C5 g/ z
  6. *& V) b6 K; B, Q3 o" T1 b& ^
  7. *   This file contains EDMA3 Test code.
    : z5 A0 X& w8 h8 J
  8. *. g1 M8 `' `4 w* v  t- b$ g" ~
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    % x* }; Y0 B3 z! [# X2 P
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT, o% A8 I8 s0 N' @! Q0 y$ p- W
  11. *         TO CHANGE.
    5 T# o) K: Q) s5 J! T4 m9 J9 y+ X- ~
  12. *. a( }( F% @- M: v- d. `6 m
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    ; x7 h3 I& B; ?
  14. *9 B/ m8 g7 L) e: |1 ^4 w. {
  15. * This program is free software; you can redistribute it and/or
    7 v, Z' E0 }3 ?' c
  16. * modify it under the terms of the GNU General Public License as
    + }6 k0 ?/ |9 M' z  c$ s
  17. * published by the Free Software Foundation version 2./ l8 @4 x5 l8 v. `+ @
  18. *
    % M  |9 t) S7 W% X. }
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any; E6 {" Q4 t2 f/ g
  20. * kind, whether express or implied; without even the implied warranty
    % S% d1 M% @% b' w
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the9 C; ~" }) h; [
  22. * GNU General Public License for more details.
    ! [# T6 G& W2 m1 k: t: {" }1 U5 P0 v
  23. */
    7 W- F. ?9 b  o5 C3 [
  24. & o2 X/ G4 R* ?* H
  25. #include <linux/module.h>
    ' x% P$ p8 {6 b# ~9 O* m0 x- B  ?
  26. #include <linux/init.h>9 i& L" ^$ o# U1 u2 A
  27. #include <linux/errno.h>
    ( @/ J+ X( }2 l# t1 f$ n! @0 x1 i
  28. #include <linux/types.h>% g  k0 r2 a) S+ i3 D- v6 M7 G
  29. #include <linux/interrupt.h>1 Q& c1 R: \+ J
  30. #include <asm/io.h>4 O; J* X4 C- o3 a& |  N# F7 z
  31. #include <linux/moduleparam.h>- U  b7 T) f" w
  32. #include <linux/sysctl.h>5 i2 l  O7 @. z) ~
  33. #include <linux/mm.h>
    9 a1 a9 X* r6 p! v, L
  34. #include <linux/dma-mapping.h>
    : _- |$ f- Y( E, B
  35. ( V. L1 J( J7 b* s2 W
  36. #include <mach/memory.h>
    1 E5 y* U9 W9 D" \" e
  37. #include <mach/hardware.h>
    ' h  {( c# p/ X' \4 w- E
  38. #include <mach/irqs.h>$ {% j" ]+ }  m: v4 f' ^% q
  39. #include <asm/hardware/edma.h>
    - v" V5 Q3 R! a6 |3 f

  40. / P& M0 p. G, I/ B2 @8 w# i& r( L/ f
  41. #undef EDMA3_DEBUG
    6 @8 T4 G( A0 o% C5 q1 I2 }4 U
  42. /*#define EDMA3_DEBUG*/
    # J) @! E! v. Y" u. Y! q, {
  43. 6 a( _7 V; J& g& v! F1 ]
  44. #ifdef EDMA3_DEBUG
    2 `% m- t9 i6 d2 e; |9 m
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS); I4 S2 G9 b# f, |& ]5 m
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)' W! g) W+ |9 E) h
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__); Q& }3 w) P. `$ P& Z
  48. #else
    % }" a( q0 U% {
  49. #define DMA_PRINTK( x... )& ?' d  s/ e7 b8 W! n( R
  50. #define DMA_FN_IN
    + J2 l' U; I0 r. L
  51. #define DMA_FN_OUT. B9 n( j0 X1 `8 I
  52. #endif4 F) H/ E6 \; c3 A8 u8 d; L8 O' T

  53.   y% f# L! g8 I
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    3 }/ k4 y$ y7 s. F2 ~8 m( d" j
  55. #define STATIC_SHIFT                3
    : I3 S9 d5 b) o  D
  56. #define TCINTEN_SHIFT               20
    6 T0 m7 c# f  L
  57. #define ITCINTEN_SHIFT              21, b8 z4 L0 |5 e/ I2 ~& J
  58. #define TCCHEN_SHIFT                22! P, S+ I8 V. m
  59. #define ITCCHEN_SHIFT               23  c2 N6 M( R3 G/ l1 ~3 l
  60. 5 Z6 O3 Y, M  q; E
  61. static volatile int irqraised1 = 0;
    0 c' C' U4 S: B7 y  N
  62. static volatile int irqraised2 = 0;
    * `7 T9 [$ l. P% R; f

  63. 0 ~! L- G$ [! G1 m
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);) D& Q0 B7 C+ P8 p! Y
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);' I. ^: c, S( Q9 h8 y' U
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);$ c6 U! T, i( T+ J7 f

  67. ; X1 ~7 a$ s) U6 J7 O2 j( ^! M# {
  68. dma_addr_t dmaphyssrc1 = 0;" w" Z4 ?& E  g  L: Z" D5 B, L
  69. dma_addr_t dmaphyssrc2 = 0;
    ' _0 ]8 x' M$ n( b
  70. dma_addr_t dmaphysdest1 = 0;
    ) L7 d4 k" |2 E, q
  71. dma_addr_t dmaphysdest2 = 0;
    0 y4 D8 ^4 B, g

  72. % H3 D+ E: G! z
  73. char *dmabufsrc1 = NULL;
    # p9 V6 C' k( ^9 ]0 v& {
  74. char *dmabufsrc2 = NULL;4 @- n4 ]8 J* Q* J9 p# Z
  75. char *dmabufdest1 = NULL;
    ; i! l7 \3 e' B* \# ~) I% U$ g
  76. char *dmabufdest2 = NULL;) |' z6 `& y$ W. j- N8 ~  t; o

  77. 7 p; v6 `7 \) O  H  g, X
  78. static int acnt = 512;0 s  F8 K* @3 {/ Y) g
  79. static int bcnt = 8;0 q( {' w9 b, |5 y$ I# X
  80. static int ccnt = 8;
    " N! a. ~+ J, O+ w  y% I

  81. # i0 w& z" {% ?% m9 ~( e4 W& f
  82. module_param(acnt, int, S_IRUGO);
    3 ]1 t6 S* p6 X7 _0 M1 S
  83. module_param(bcnt, int, S_IRUGO);
    " M6 o" |" R" q0 a
  84. module_param(ccnt, int, S_IRUGO);
复制代码

0 v' n" j/ `6 K, p' x$ j* q
; U& S# n7 |5 F# U8 l3 X      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
4 d+ [' z# b2 n: C9 L) [  s% [, aarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。$ f9 H% Q( m; Q+ Z* D
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。( q; }5 @6 J3 _1 k  ~! S0 b, p

: F3 J' s8 s& q+ S0 e( {  @
' l9 U; w( r# J
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-2-15 14:15 , Processed in 0.044278 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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