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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
  c/ Z" E1 v( M3 a
  1. [code]EDMA sample test application9 Q& Z7 U* f. K' P0 s) f$ O
  2. /*
    7 w) ^4 q$ ~9 U: x" e, w* y
  3. * edma_test.c9 n% K( m/ q# {( K& t3 j
  4. ** x8 ~" H8 Z4 C. C- ]% W
  5. * brief  EDMA3 Test Application
    # R  m7 o8 ~* H: z
  6. *& Y6 q0 Z$ s5 F9 e# K, `$ {
  7. *   This file contains EDMA3 Test code.
    / P5 p$ b; h" L( c" Y$ X
  8. *  L) ^$ c5 F2 o( p* I* ~) j! V
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    3 U5 u# }0 x& b2 P% {, s1 j
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT- T6 @- b! C1 S* k$ E2 F% g" M  a& d1 O% U
  11. *         TO CHANGE.* {1 R8 e  G: _5 n1 H: r9 t/ n7 ]/ `
  12. *
    # n8 E( |' V4 f6 V! q
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    + [0 X/ o  b! F6 ]# b# \' A0 ?6 q1 \
  14. *
    ( u% x" \( ^1 A% V- T7 i! `2 S
  15. * This program is free software; you can redistribute it and/or
    : W9 h% m- e, t5 U$ {
  16. * modify it under the terms of the GNU General Public License as( j# q  F* B1 _* p# ]0 \& _# I
  17. * published by the Free Software Foundation version 2.
    7 O2 t. V7 `* _$ E* G
  18. *& z( O& Y8 d2 X% Q) j: a. C0 H7 \
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any3 W, P6 [' L6 u# d; T
  20. * kind, whether express or implied; without even the implied warranty
    1 E/ i! y% }- F1 P
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    5 d4 [- e; }! v
  22. * GNU General Public License for more details.
    ; Z; \+ y$ b8 h
  23. */
    2 O& j- k8 e6 a  `( b

  24. 3 a% B8 W/ a7 ~) i
  25. #include <linux/module.h>
    * ]" T# `% n( s3 x5 L: M
  26. #include <linux/init.h>
    : i, n9 R# {4 v
  27. #include <linux/errno.h>
    ) b* k% _, P1 k2 W* u+ L
  28. #include <linux/types.h>3 A. y7 K$ \9 W$ M* Y! N
  29. #include <linux/interrupt.h>- ]! @& B! Y  O- A& L" v
  30. #include <asm/io.h>/ H& Z/ u1 v) l3 @" M& h1 }
  31. #include <linux/moduleparam.h>
    % P" a5 ~5 L" l! l
  32. #include <linux/sysctl.h>
    7 S5 I; ^5 V: a& K" ^
  33. #include <linux/mm.h>" L6 k1 e  E  x" T
  34. #include <linux/dma-mapping.h>
    : S# O( M8 ?9 ?5 c( ?

  35. ' ~( B  e0 K* X, y
  36. #include <mach/memory.h>
    9 [' I/ L; ?2 b
  37. #include <mach/hardware.h>" Q4 r* m9 s9 q* y* L0 R
  38. #include <mach/irqs.h>
    + I+ x1 J# A) q' x" B
  39. #include <asm/hardware/edma.h>2 Y2 Z( c+ U9 t, N. `# s0 m; x" ~
  40. & v- y9 l5 {- T: O9 s# L
  41. #undef EDMA3_DEBUG+ o% R+ @4 W& K
  42. /*#define EDMA3_DEBUG*/& F3 q' t$ g* Q# X- W( c9 X; ^7 @3 Z

  43. : G0 u: ~- M: r7 X: d
  44. #ifdef EDMA3_DEBUG
    / X. F# c  T$ O% Y- w! d2 B
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    ! a$ h! L, _) X
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)4 |5 `5 O4 I% K
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    ( D+ w& _; y6 H8 a
  48. #else
    ' X4 T  W: t( _$ x. g$ A% v# ?
  49. #define DMA_PRINTK( x... )
    . R  [7 p2 B5 \2 @2 J2 F  T
  50. #define DMA_FN_IN
    4 h+ ~6 `! f3 c. x9 y2 k
  51. #define DMA_FN_OUT; J6 i2 h- D9 ^% X: C' D7 {. i
  52. #endif
    2 G8 C8 H8 o9 |* X/ ^' e9 d# c

  53. " Q; R* f) Q! ]4 A
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)' W- d8 a* I0 O* j( X4 p" A
  55. #define STATIC_SHIFT                3
    + C& S% T! D0 }$ i
  56. #define TCINTEN_SHIFT               205 J4 X9 Z. J' i2 V+ k4 _
  57. #define ITCINTEN_SHIFT              21
    % x& W! N' W! @/ e
  58. #define TCCHEN_SHIFT                22
    ; L: P* }, h' z% c/ i/ y
  59. #define ITCCHEN_SHIFT               23
      K5 a; H/ v+ \( E3 K: ]
  60. 7 S6 _! G% d% E! U/ V' u8 }
  61. static volatile int irqraised1 = 0;6 ^6 V* L- n0 M! [1 N5 r1 S
  62. static volatile int irqraised2 = 0;, N& A8 v* b* f% Y; S" ^# L
  63. 6 ~; K9 k3 }5 ]
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);) Z- b  y0 Z6 \/ B3 P/ F- p
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    6 r; u* _% G5 H) [5 ?+ @
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);- \. v+ t* [6 a  P( x2 K

  67. * w8 n3 j0 n% X/ f9 _
  68. dma_addr_t dmaphyssrc1 = 0;
    : f1 `, Z: W* U4 e* x
  69. dma_addr_t dmaphyssrc2 = 0;
    2 p5 y. c9 a% V4 q; S/ w% z
  70. dma_addr_t dmaphysdest1 = 0;, G5 t( ?& n( D& R4 o6 ]
  71. dma_addr_t dmaphysdest2 = 0;
    * T5 S0 y& z2 c5 j
  72. # b  ^- Z3 h4 w3 E% ~/ @, w
  73. char *dmabufsrc1 = NULL;
    % h3 H& d$ L2 n. e" Z
  74. char *dmabufsrc2 = NULL;& S6 b, k3 s) e7 K
  75. char *dmabufdest1 = NULL;  P9 c2 @6 G5 B8 f( Z' A% d' z4 l! r
  76. char *dmabufdest2 = NULL;  R" D' x4 c) K

  77.   ~+ A* z6 K; ]& g+ m: C1 }* e2 T
  78. static int acnt = 512;
    ! R: K8 x; f$ }& F3 r) a
  79. static int bcnt = 8;5 a9 Z- `* J  q2 F9 D* w, u9 C
  80. static int ccnt = 8;
      L" l' `8 f9 v# d# G% d' ]
  81. : B# m, @1 p# H1 I' L# l
  82. module_param(acnt, int, S_IRUGO);0 }* q5 w/ e& x6 z* P9 d+ k
  83. module_param(bcnt, int, S_IRUGO);
    9 I0 U* y1 K; c( `2 B" m
  84. module_param(ccnt, int, S_IRUGO);
复制代码
% p) ]& ^4 \2 m7 O  ?7 \

5 J9 z  K  {; m. W      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用2 O/ j5 {# X/ k) U
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
$ l0 o/ k0 D) ]# Z) t' ^     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。& a4 W8 M& |) P$ @% B0 [+ I
% ^/ W" g  z* F9 t

$ i1 q7 v7 y- J
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-8-27 02:45 , Processed in 0.043672 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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