OMAPL138如何在Linux下使用EDMA3驱动 - OMAP-L138 - 嵌入式开发者社区 - 51ele.net
设为首页收藏本站

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
# [' \! Z: y" s: Z' n
  1. [code]EDMA sample test application
    - x+ F& P3 d3 P
  2. /*' {- @( h( }* t! G( m% t. N6 S; j1 C
  3. * edma_test.c
    + R( t7 p$ }- w6 Q
  4. *
    6 S7 e2 }! q! a. J# K9 w/ A
  5. * brief  EDMA3 Test Application
    / a8 m- v* u) n3 R& v8 j
  6. *0 y9 y: ^; H" m& Y4 Q! L: ~# L
  7. *   This file contains EDMA3 Test code.
    7 k* w, A: x# [2 l, Q/ t# R; ]/ W
  8. *+ c( ^: G; e% H9 O$ M6 v2 @
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE! c' y6 {7 c0 U6 e) F! N& Z7 {
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    & u8 \6 T1 J1 e" e5 R4 E
  11. *         TO CHANGE.
    1 [/ X( k4 k# s
  12. *
    % L) u- N/ K: K+ M/ X  o9 O
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/, x" x) D& |( X7 s
  14. *
    , O: b" L4 r! g5 X5 m
  15. * This program is free software; you can redistribute it and/or
    2 I9 N/ Y- ^* P0 Z- Q3 z& g
  16. * modify it under the terms of the GNU General Public License as
    * N$ T: v% O) l+ g9 I9 n4 i
  17. * published by the Free Software Foundation version 2.7 I$ n7 l) K. f
  18. *. `+ L: h* z6 n1 p# y
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    : |/ l2 z- k8 K
  20. * kind, whether express or implied; without even the implied warranty
    / U$ Q( Q/ W8 G! G9 z+ s& `
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    ) g; k- N- f; o& q$ D# L6 N
  22. * GNU General Public License for more details.6 Z& f: u% g7 D, [
  23. */' q3 C& v3 ?- `8 ^& F
  24. 8 K" v1 N4 M5 j
  25. #include <linux/module.h>2 m& x6 q0 j7 [: z* |2 z
  26. #include <linux/init.h>, A$ t- I" K( C- G
  27. #include <linux/errno.h>3 |  H; X% v* @! ]. A% @/ }) w
  28. #include <linux/types.h>
    $ n/ @- ]7 v! n5 p
  29. #include <linux/interrupt.h>
    1 J, [4 G5 w1 ?- f8 v
  30. #include <asm/io.h>+ i! R4 P7 C  Y3 w+ W6 B
  31. #include <linux/moduleparam.h>- ]6 E5 y- @# w3 O/ H0 q* X
  32. #include <linux/sysctl.h>! v, {8 g- N. H" R; Y; Y5 U! s
  33. #include <linux/mm.h>
    - s$ {& x% Z  Y! y$ L# t+ S
  34. #include <linux/dma-mapping.h>
    7 J8 Q& t! d" |( F0 L8 m) r
  35. 4 B' d4 o- r" m, _- E
  36. #include <mach/memory.h>
    ; {1 O1 R" C3 \1 X9 X  i5 v
  37. #include <mach/hardware.h>8 v# E: @: P' {& a5 o0 N9 I$ u7 N. z
  38. #include <mach/irqs.h>5 T" T' L8 g7 W9 V
  39. #include <asm/hardware/edma.h>
    - |# g. r7 V$ K3 A
  40. - K, j/ X6 P) o  A1 t' I, P
  41. #undef EDMA3_DEBUG
    ! R8 s8 @; c9 A: p% v# y; N# B9 T
  42. /*#define EDMA3_DEBUG*/7 l2 r  }6 S' x% o' U2 _
  43. " _# F( v; g4 B0 |9 H) w- V& D8 }; ?
  44. #ifdef EDMA3_DEBUG, E( p; |: W0 E: ]5 o
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS). R, N5 j2 E- R: x: @! r3 ~& [; R
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    / o5 a/ L4 q6 D, a; u7 V4 \% R
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    3 p+ M  `% q3 |0 G( ^1 o" S
  48. #else
    , Y* E+ ?* l, k2 n$ E. @) q" @3 P% P
  49. #define DMA_PRINTK( x... ); ?2 O& W$ z" |4 P7 |
  50. #define DMA_FN_IN
    : a& X, ~1 E9 J' f4 ^
  51. #define DMA_FN_OUT
    % f; e. V8 k0 L2 R( g) D+ T
  52. #endif  Z% P8 w3 g9 @" _( |6 G! {5 v

  53. ! e. F4 h& j: k  x! ^: }$ U
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)- y  K  ^8 L' [$ [8 l- R
  55. #define STATIC_SHIFT                3. ~$ E' F, ]4 M) }
  56. #define TCINTEN_SHIFT               20
    * `+ ]  V5 ^$ O( G( H, ~/ U. X
  57. #define ITCINTEN_SHIFT              21
    % Y  K* F! ]" [
  58. #define TCCHEN_SHIFT                22( B! Z0 a; t/ ]+ [
  59. #define ITCCHEN_SHIFT               23
    - o! @, y. |0 T* I1 s* _7 J
  60. ! V, ]4 x( m8 R  i/ _
  61. static volatile int irqraised1 = 0;
    8 X6 O( ]2 ^" m# \7 q# N
  62. static volatile int irqraised2 = 0;" A) G- R, [: ^9 y$ b8 n% g9 m
  63. # ?4 F* M- c2 u; m  }  l
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);& P+ w, B3 j  n; H% j
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);; }1 m$ e* s2 i/ K: u/ \1 S0 S0 `
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);) r2 |8 W: A" Y0 {9 _& C" ~

  67. 7 d$ R& q& l0 X
  68. dma_addr_t dmaphyssrc1 = 0;& ]7 ^2 j: n- b$ {: m2 i
  69. dma_addr_t dmaphyssrc2 = 0;& \, c1 J3 T1 @5 Z* n! D- l
  70. dma_addr_t dmaphysdest1 = 0;
    * a) u6 g% L, v3 w* s, O
  71. dma_addr_t dmaphysdest2 = 0;
    # }7 Z, u& a2 c9 D

  72. 4 ]9 W2 e: M  H
  73. char *dmabufsrc1 = NULL;
    ! U+ \1 ?! p# e
  74. char *dmabufsrc2 = NULL;
    8 A6 G" W7 t* `: ?  A. ~. L
  75. char *dmabufdest1 = NULL;; b4 s# |' x$ D( K/ j
  76. char *dmabufdest2 = NULL;
    / E& T2 D; O! g) `- Y3 A
  77. : J1 c5 n. b8 |) B; i# y/ K
  78. static int acnt = 512;% \- P* \0 h- ^; x* Q/ Y8 F% y# C" R
  79. static int bcnt = 8;
    6 ?" H  J: M" O9 n" K
  80. static int ccnt = 8;( |, D% G% y4 B4 l/ X

  81. & {: g: F& x* p. l9 n' V  p" L$ N
  82. module_param(acnt, int, S_IRUGO);5 J  R% |! l  v# ~  o9 _: R# x
  83. module_param(bcnt, int, S_IRUGO);0 B0 x: D! J; t; [
  84. module_param(ccnt, int, S_IRUGO);
复制代码

+ {/ n: m: ~( C2 ?' e3 I# x- o1 t- I, K& _2 P1 D
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
$ l" S0 _2 w' @! X, Larm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。8 Q7 c  C( Z; N: R, o
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。. ~$ U2 E4 Z; R; F6 k$ @: _
: A: o) \  S, a$ X0 L
8 r1 \" U0 q. ]' k
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-9-16 08:20 , Processed in 0.036303 second(s), 24 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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