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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
2 t" W6 U& Y6 U7 q% B9 t1 p/ [
  1. [code]EDMA sample test application
    8 i. v3 y8 R, r  G
  2. /*8 X" F/ v' B  M( `: @: ]% Z
  3. * edma_test.c. q1 _7 l# x- d2 t! D- r
  4. *, }* |' J- c5 F% z
  5. * brief  EDMA3 Test Application) m" S# c6 S/ }0 }. T( N
  6. *
    ( l; Z) w2 K3 P5 O6 C- m$ S0 N
  7. *   This file contains EDMA3 Test code.
    " m7 [1 T' {  U) w3 S# q! ^
  8. *; i4 j; `, \" |1 a
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE: {, `8 ~( M) ]; \
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    7 z/ y' H: j4 ~# `" O* q" K
  11. *         TO CHANGE.
    ) i: }' \! F# c0 G. E6 k  [
  12. *& ?- `9 i4 p5 W$ T
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    0 y+ M/ J4 d% u5 G2 T
  14. *
    ( d& `, m% c" s" h' v8 o
  15. * This program is free software; you can redistribute it and/or8 M# {8 K: R6 L
  16. * modify it under the terms of the GNU General Public License as
    + x* v% f  `* U+ h
  17. * published by the Free Software Foundation version 2.  L# L# U+ p/ S5 O
  18. *
    ' U# Q# ^$ R, v( t# u
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    ' @# e$ V  o/ a- |! G
  20. * kind, whether express or implied; without even the implied warranty$ |/ n6 H! v& t
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the$ \4 L) ?: L$ A" Y
  22. * GNU General Public License for more details.' b0 g% Q' j  n. z% a2 Q
  23. */
    : j2 m* J- {* G% ~

  24. 4 H: L( V4 o8 z( M1 O, G
  25. #include <linux/module.h>
    % F6 u9 {+ `2 D# L  a. [
  26. #include <linux/init.h>
    ; p& \+ z. D& s$ H- H8 {, A
  27. #include <linux/errno.h>+ A0 b6 s( y5 e! v8 H9 T
  28. #include <linux/types.h>0 Y! y1 D. L5 C9 S% G( D
  29. #include <linux/interrupt.h>
    5 L8 I0 `5 D: I& B( R6 `  t
  30. #include <asm/io.h>
    * p" R3 r  u8 U+ k- w2 E; D  B
  31. #include <linux/moduleparam.h>
    ; T; p. w, Y. Q, }1 p, h
  32. #include <linux/sysctl.h>+ c( u' z" y! Q8 g- ~% n/ q4 j
  33. #include <linux/mm.h>5 s$ q- K2 o; ?  D: n. V
  34. #include <linux/dma-mapping.h>% s- X, N# e4 T/ c* m4 N( Y+ Q
  35. ( f  J6 Z: a" a- O$ C$ J
  36. #include <mach/memory.h>
    5 L+ o& m$ `2 e- n
  37. #include <mach/hardware.h>4 {5 y& z9 J9 ]5 S$ P( L( X1 I
  38. #include <mach/irqs.h>  T  U* q+ @+ M* C& W
  39. #include <asm/hardware/edma.h>
    2 q  S3 J8 T( ?3 L5 D

  40. 2 |- b! U6 @. _& P6 X+ \3 n5 X
  41. #undef EDMA3_DEBUG5 H  }9 d8 Y6 [: X4 H
  42. /*#define EDMA3_DEBUG*/) g3 p5 {: y" E  J
  43.   Q' Y) m) B8 B$ }' V3 i: k# ?
  44. #ifdef EDMA3_DEBUG
    $ L& J+ @' Z- T/ W
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)4 V. F" M: O0 R: G+ d; l
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)6 Y1 d0 p% _; Y0 X$ x6 j0 G( E
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)3 R( d9 n" j- n! J
  48. #else# m( v/ N/ t- H- q' s9 {
  49. #define DMA_PRINTK( x... )$ y* K2 X7 v- w
  50. #define DMA_FN_IN
    ! k0 W. d5 l3 `* \3 c7 b
  51. #define DMA_FN_OUT1 O. Q2 W# G$ A' s! @* E
  52. #endif
    . `% N6 f8 e1 y3 Z, K# P7 l
  53. , T/ \6 t- A/ B9 C
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)/ P4 d% O' P2 K
  55. #define STATIC_SHIFT                3
    ; L+ v9 h+ o3 b7 I
  56. #define TCINTEN_SHIFT               20/ g/ H9 ^7 |- k
  57. #define ITCINTEN_SHIFT              21
    0 h! w/ O7 f# Y& u
  58. #define TCCHEN_SHIFT                22
    # F9 `- Z, e* v. x/ F8 f5 f) V
  59. #define ITCCHEN_SHIFT               23: q( A4 I7 W7 R8 L' y+ {" O! U! [
  60. 8 G. g& u" h3 H/ }
  61. static volatile int irqraised1 = 0;
    ! W* e! z) E  P  B& c0 Q# ?
  62. static volatile int irqraised2 = 0;
    & q, V0 I' T5 A' Z% P/ I

  63. . j: j9 a1 q5 s! S
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ( |" I$ ~. ~# Q/ d3 p. s; _
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);( }8 {% G6 o2 V. h
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    * I3 c* B. _) Y+ m. x

  67. # T% _7 l, y+ F8 \& B( g' o4 k
  68. dma_addr_t dmaphyssrc1 = 0;
    + t$ D& |( A; c, r$ }9 D
  69. dma_addr_t dmaphyssrc2 = 0;
    / w( s3 g0 l9 }$ p' n! p
  70. dma_addr_t dmaphysdest1 = 0;% J: A3 \* g9 K# |( j  d* \
  71. dma_addr_t dmaphysdest2 = 0;/ Z4 f1 q( {% m: S) V
  72. * M8 W  b! M0 G* @/ m8 e
  73. char *dmabufsrc1 = NULL;
    , [1 n1 s  g0 m
  74. char *dmabufsrc2 = NULL;- {( G( H1 ~/ e$ V9 e
  75. char *dmabufdest1 = NULL;/ z( |9 S# e6 m. J
  76. char *dmabufdest2 = NULL;8 l$ ?8 l1 }* f! {6 r" q. b( q8 v3 n

  77.   l. X, F/ b! p2 Z9 i
  78. static int acnt = 512;6 d/ y$ B6 I& Y/ `. a
  79. static int bcnt = 8;' C7 H; ^' p2 b( T1 V% N
  80. static int ccnt = 8;
    - v' s% g9 S( {

  81. " g* E0 H" K7 w4 M' f3 p" m" W
  82. module_param(acnt, int, S_IRUGO);2 a) N; @7 l. l4 J$ x
  83. module_param(bcnt, int, S_IRUGO);8 K3 B! H& J) z3 g' g4 a
  84. module_param(ccnt, int, S_IRUGO);
复制代码
$ _' o1 v- D& Q7 C
9 ^3 J- R3 @2 c  y6 X) J
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用( }" J$ V+ K7 \" c* n
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。/ Z  E+ p) L( R, a( U: n
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
7 K4 K" e; L( w( o4 F5 _' d& o4 A' [  {- m* M( O2 ]

" u( X. k4 {: c/ Y# b
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-2-14 12:08 , Processed in 0.040512 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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