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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 # \% G' D+ l0 A7 p; T! y) q
  1. [code]EDMA sample test application
    % ?0 o6 |5 i  L) J2 ]  a
  2. /*
      b$ b5 A/ J* m
  3. * edma_test.c' V! Z6 }0 D- p. j# l, d
  4. *
    ; W& g4 s7 W9 p) ^1 n/ }% Y  Q
  5. * brief  EDMA3 Test Application
    & d0 [8 ?# U2 P& V; i: |& X. z2 @
  6. *
    1 S! j6 S$ |' h1 w6 Q
  7. *   This file contains EDMA3 Test code.3 k6 s' z4 Q  F
  8. *6 B/ _6 A9 B. ?; ^, p
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    2 y( Y' |- `6 m6 s( K
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    & Y) h0 E2 T( F! z5 `$ }; K
  11. *         TO CHANGE.
    / q1 {" Q4 R* _8 X! X! V) k/ d
  12. *8 C0 g3 [0 y6 Q; t! [& o
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    $ k1 q' b! d2 v" a& U% ]
  14. *
    6 N! J# T7 I5 V6 ?! [
  15. * This program is free software; you can redistribute it and/or& \9 N3 ]2 m* A& l7 Z) {+ e. a) C9 f5 C& b
  16. * modify it under the terms of the GNU General Public License as
    : b' Y+ E; Z0 I0 V
  17. * published by the Free Software Foundation version 2.) A) c1 n2 @; l+ ]& G9 o
  18. *
    2 x/ S: |& A3 u- v9 g1 u3 k$ y9 T
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any. d( F4 S8 n! W% [3 l& n
  20. * kind, whether express or implied; without even the implied warranty
    % z8 n2 B6 e* O- [5 x, H6 B
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the0 `) _1 S- t8 Z
  22. * GNU General Public License for more details.
    0 t" u2 R# K* [7 I
  23. */
    % a: d4 }) N' g6 R6 D

  24. + A- P) [$ ^( P  }# Z. a' H
  25. #include <linux/module.h>
    ( a; B/ l6 z, H' @6 I
  26. #include <linux/init.h>% B6 }" S9 }, y' J
  27. #include <linux/errno.h>4 s' w& L* S" E9 t4 y) n8 H' X
  28. #include <linux/types.h>7 t  M" A7 E5 l1 W. {4 i; P7 ?
  29. #include <linux/interrupt.h>
    6 U+ W+ l# {9 \
  30. #include <asm/io.h>' ?% C- Z: z: A0 Z* ?7 r
  31. #include <linux/moduleparam.h>. H% Z% T7 B5 e. c9 j
  32. #include <linux/sysctl.h>
    $ z+ _9 @, @. f/ V, j1 A* f7 ^
  33. #include <linux/mm.h>
    ! d, g3 b6 D1 |! V7 @+ k0 y3 N" l
  34. #include <linux/dma-mapping.h>8 J! q, D# C2 T$ a0 ~5 Q: |7 T# T

  35. & y% H* I" I+ K5 b
  36. #include <mach/memory.h>1 m8 `' l, x( g" o* S/ V. ^/ }! B5 [
  37. #include <mach/hardware.h>
    ( v1 j% U% I, v2 A
  38. #include <mach/irqs.h>% J9 t& s: z3 o1 D6 K
  39. #include <asm/hardware/edma.h>/ U+ y' ?/ I( I) S

  40. 4 I5 ]+ H8 y* g/ u5 s. S
  41. #undef EDMA3_DEBUG! y' |* F! K" h' w# S4 K1 g8 {
  42. /*#define EDMA3_DEBUG*/
    - ~6 x: ?/ Y2 N5 _1 c; v/ r" e1 g3 u

  43.   z, K' E0 C+ t1 H* V
  44. #ifdef EDMA3_DEBUG
    4 \2 w4 o9 Q8 G, v( F3 h
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    7 G! W& h: s6 r' `" i6 x
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    & k/ k* A1 F9 D; l# n; M
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    . d+ B# d/ o6 g( [
  48. #else
    9 A0 G& \3 z& a
  49. #define DMA_PRINTK( x... )
    9 C% Q5 c; {  I, D  H/ L! E
  50. #define DMA_FN_IN& m- I" w1 w( |8 w+ J# w
  51. #define DMA_FN_OUT
    % n3 a8 M7 m" P% D/ v' k$ M0 p. o
  52. #endif
    , @2 K: `) h) V
  53. ; Q2 c% i$ f! i
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)0 {7 E  Q  `$ A1 J- z
  55. #define STATIC_SHIFT                3
    2 b0 l6 H7 e6 j6 \' a' Y( Z; Z
  56. #define TCINTEN_SHIFT               20" i9 Z" l# u& y! s; p" Q$ [& u) W
  57. #define ITCINTEN_SHIFT              21
    / D4 \9 |$ a& ~4 X% ^# K
  58. #define TCCHEN_SHIFT                22
    / {7 B5 w' [! B' D# [0 i7 V
  59. #define ITCCHEN_SHIFT               23
    ( r" }* l) D/ M# L; x8 b! a
  60. ( w" n" N- w. S! b0 c. x
  61. static volatile int irqraised1 = 0;
    7 H6 c9 O+ @3 ?' a/ f
  62. static volatile int irqraised2 = 0;9 E0 T+ _' |, u+ e+ f/ a' w9 \

  63. ; x- ^$ j6 r7 J- n2 {
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);( G* O" l) M. }1 j% @
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    / W  o: w( _; l9 @! ^
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    1 j6 T3 v# ?, U; @

  67. - x# U; |8 P* O2 T
  68. dma_addr_t dmaphyssrc1 = 0;8 t- T7 d9 W9 X+ E
  69. dma_addr_t dmaphyssrc2 = 0;
    % |# _% N& j7 V- O* M7 }- m
  70. dma_addr_t dmaphysdest1 = 0;
    ) F$ S  F2 U- M$ A4 o/ J& m" A- I
  71. dma_addr_t dmaphysdest2 = 0;5 H* L. ~& E2 V" _

  72. : u2 A4 O7 B% O  u
  73. char *dmabufsrc1 = NULL;5 z/ A4 X; L0 ?- b5 ]0 W) ?2 T
  74. char *dmabufsrc2 = NULL;2 r$ R3 I, y6 {' k% b
  75. char *dmabufdest1 = NULL;) @5 l( _3 {  \: B: N- K. E
  76. char *dmabufdest2 = NULL;+ V6 w: q! k1 Q8 N: C' \
  77. ) i: T6 p" f" z$ n
  78. static int acnt = 512;( t  T, p: o6 S
  79. static int bcnt = 8;
    6 i( F/ c4 L  S% O* S4 b: L
  80. static int ccnt = 8;
    0 R; w; u! o) k: C

  81. 7 u% |% S8 Z: c% d; z, U& @
  82. module_param(acnt, int, S_IRUGO);. X6 y9 S9 ]' m5 q) E0 n: {5 V
  83. module_param(bcnt, int, S_IRUGO);# h8 p: H  W# X
  84. module_param(ccnt, int, S_IRUGO);
复制代码

  Z7 t" C! k- i
( V5 R+ V: Z. ^2 `6 x: z      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
+ h% Z* S- t* _6 Y! S/ Xarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。4 o. d" [) |4 Q% P0 t6 i0 `* g
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。  R3 w6 g+ w0 j7 x4 T# ]. i
+ {4 r# X- s$ ?7 w# C
8 P5 o( g7 U$ d6 z
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-10-13 04:17 , Processed in 0.046891 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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