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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
8 m# E, @, @  E9 }- x
  1. [code]EDMA sample test application0 X8 Q- V, u1 x, x6 _) x
  2. /*
    $ B% q: g' s: y* s9 [$ n' t
  3. * edma_test.c
    ; \2 g, ]7 P3 j) N9 v: |. W
  4. *' A4 x2 L! b( G) s5 K
  5. * brief  EDMA3 Test Application& n2 a6 f( W. f1 @! |
  6. *7 R; ~2 _( W) g/ `7 l
  7. *   This file contains EDMA3 Test code.
    7 T9 i# i1 C, \& {1 F- O' H# }
  8. *  i+ _  t1 G9 o
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    ! ]: `+ q" @2 J5 n) u7 _
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    1 a1 D6 G2 J. i
  11. *         TO CHANGE.: O' `: q: |! A8 d) K" e( O+ |
  12. *
    ! q! e4 @/ b& d$ H, R0 N
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    ( j) z' h; Z6 k! G" Q
  14. *  E5 L1 [2 E" Y+ M
  15. * This program is free software; you can redistribute it and/or9 ~6 e8 _' \3 q! b$ L  ^! d, Z3 B
  16. * modify it under the terms of the GNU General Public License as
    - ]; K, F6 H7 Y; ]- @
  17. * published by the Free Software Foundation version 2.% _: l' w: \" h" s6 ^
  18. *
    , D+ S0 ^2 h6 G" e- u
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    3 p7 X0 I. B- P
  20. * kind, whether express or implied; without even the implied warranty9 T' `$ u1 z) t
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    ; ^5 v( c' |" M: `2 @
  22. * GNU General Public License for more details.) w/ J5 |# n, c# o3 z
  23. */' T: I$ I8 i/ T  H- p

  24. $ Z' A, Y$ g( Y% ], u" Y) @' J3 L3 e
  25. #include <linux/module.h>4 ~! H& Z% r5 m9 `+ o6 p
  26. #include <linux/init.h>
    . V1 F( \# V- v$ w
  27. #include <linux/errno.h>  n% G7 H7 I( z4 J6 \7 {! U/ u
  28. #include <linux/types.h>
    6 U0 c0 D# T' h- N
  29. #include <linux/interrupt.h>  O  L3 p2 j4 W# M
  30. #include <asm/io.h>* s" ?) j4 a; N! I3 Q
  31. #include <linux/moduleparam.h>9 z: i2 c$ f7 g
  32. #include <linux/sysctl.h>5 W: _( u' t- a7 Z6 l  ~
  33. #include <linux/mm.h>
      q3 I, T2 H9 P" g
  34. #include <linux/dma-mapping.h>" U/ j0 |* f! A
  35. 7 P, ]% g( u* v  W( b5 N
  36. #include <mach/memory.h>
    7 B# ^& ?  i; o. P, u: S5 ]' d/ b
  37. #include <mach/hardware.h>
    ) S" o% ~5 p2 F
  38. #include <mach/irqs.h>- ?8 G2 n5 `9 k0 J# S
  39. #include <asm/hardware/edma.h>
    , j' H* f2 C1 \8 f

  40. 1 }; V4 u' V% ~4 w" U
  41. #undef EDMA3_DEBUG* Y) m1 @7 I9 P' r5 j
  42. /*#define EDMA3_DEBUG*/7 C) [7 m! m) P$ ~3 R0 k% ^

  43. ) }( a7 {* M9 [5 Y. C8 n' B
  44. #ifdef EDMA3_DEBUG
    , |/ Z, z0 ~9 D+ Z) O8 v* ?
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    0 q% Q5 T; ?. ^, M) d
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    , H9 _! N- |" A6 Q! h5 k- s, h
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)+ P# o( n; j: Y* l' J: J/ I% P
  48. #else
    - v: Y& o4 S- r: o0 y* r
  49. #define DMA_PRINTK( x... )
    4 x/ z! q8 M" \3 l  F
  50. #define DMA_FN_IN
    ! w: @, D5 S8 v( X7 R
  51. #define DMA_FN_OUT
    4 P. @6 p% Z9 I0 Q
  52. #endif
      b# y( R- |% o' A
  53. - ~* J3 |5 b3 b" b$ f+ o* R
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    5 G) e1 z) e! u: K6 `# R" o( V! f* p
  55. #define STATIC_SHIFT                3. Y  Z# R9 Q3 C2 E* a
  56. #define TCINTEN_SHIFT               20
    ; W& ?5 s3 F5 d! z7 t1 }
  57. #define ITCINTEN_SHIFT              216 a2 H5 Z$ g  d
  58. #define TCCHEN_SHIFT                22, j  h* r1 @6 a& V
  59. #define ITCCHEN_SHIFT               23  Q& N# \9 h. w/ w1 ^: P1 n2 p- E
  60. " G. F: }/ v$ Z" r: r# t8 G
  61. static volatile int irqraised1 = 0;
    8 `/ f0 b8 [! I4 w
  62. static volatile int irqraised2 = 0;
    ! B; ^0 I4 ~$ c, R0 U/ H# c

  63. , J' L4 e  Y% c3 }2 W
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);  O4 B& q  E2 P5 u: @$ {" u3 L
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);* n& {1 j" J5 e/ p( o9 [
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    # l* P) y9 L4 x5 m7 a6 V

  67. " ?6 t* F6 `% q# x  m
  68. dma_addr_t dmaphyssrc1 = 0;. f# f0 K4 f9 b& F5 l9 Q4 }! ]
  69. dma_addr_t dmaphyssrc2 = 0;
    2 y. a7 ?* S9 `4 w# a
  70. dma_addr_t dmaphysdest1 = 0;5 m; c+ ^8 l7 X: P9 K8 J" T
  71. dma_addr_t dmaphysdest2 = 0;
    - J1 T( a8 |0 P: _( g. u

  72. , c' p4 m( G. ]
  73. char *dmabufsrc1 = NULL;
    3 P* A" M& t5 Z
  74. char *dmabufsrc2 = NULL;6 c; b1 F$ a" h2 d' y, h
  75. char *dmabufdest1 = NULL;
    : k  P7 B; h  }  y  }$ ]! A
  76. char *dmabufdest2 = NULL;
    & l! {2 r+ g0 ^6 u9 S

  77. . W* ^5 n( Z6 @8 P2 K' A$ ]
  78. static int acnt = 512;( w3 b6 V4 s. O7 c: l
  79. static int bcnt = 8;$ X1 x( b4 v. p! `$ `/ i
  80. static int ccnt = 8;
    / g/ b) ]. ?. ~9 P" u
  81. ( U2 u; b7 W1 H, D7 v$ }. h
  82. module_param(acnt, int, S_IRUGO);. k. U$ D6 m( s' ]
  83. module_param(bcnt, int, S_IRUGO);) @8 |/ x' o! M# ~0 J' K! j1 H
  84. module_param(ccnt, int, S_IRUGO);
复制代码

9 Y0 j" o9 e4 n; Q1 I; ]- c+ H& W8 P  H2 `) v/ L+ M9 c
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用9 V% D3 w6 y4 g' E. S
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。/ I0 i% }, z: a2 \
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
* p4 j, O7 k. p5 h) o* N+ }; g! y3 t
* B( g, m5 N% P2 Q- \% y$ n
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-11-18 13:49 , Processed in 0.037075 second(s), 24 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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