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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 6 o- t9 E' {: C4 |( o  S, v  ^
  1. [code]EDMA sample test application' l- ], M* O2 d/ X( l6 T
  2. /*
    " D$ Q6 b) B4 [" E' e6 a
  3. * edma_test.c4 y/ v& y( k1 J  ]( {* ]
  4. *
    - [* I2 p0 Z' V* S/ M( i' z+ Y+ y
  5. * brief  EDMA3 Test Application
    4 ^+ H# B5 w- Q5 j5 n
  6. */ z) t8 Y% |- G& V9 l+ f- g
  7. *   This file contains EDMA3 Test code.
    * F+ G' j! X  ~: q& ]' Q6 h2 \+ W
  8. ** S, E# l' z) w9 x/ v3 b4 x
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    , I6 a" t- [" v* H
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT* ]1 Z5 ~: x2 m4 T7 \* a
  11. *         TO CHANGE.
    2 t3 `; K6 Y  Q  t: ^/ E
  12. *
    7 a' T- W7 p; ?: R) g
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/" D5 r! W/ h9 {, e" Q4 A- h
  14. *
    8 H- b/ f8 u, O/ o  @! j
  15. * This program is free software; you can redistribute it and/or$ P% h1 ~0 Q2 \" l( S. `+ D
  16. * modify it under the terms of the GNU General Public License as
    5 a  k* {; B2 L
  17. * published by the Free Software Foundation version 2.# B& W/ s+ `/ ?2 z: ^1 r1 I1 K0 P1 b
  18. */ _5 E1 _) ?) L4 Z9 r# M2 R
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    . N8 F+ n* L+ N- b. `. Q8 H) o, l
  20. * kind, whether express or implied; without even the implied warranty2 W! f- W, {3 l! }& @  G) e: e- j
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    6 A6 C- _! \; u/ k- E  {
  22. * GNU General Public License for more details.
    7 k/ h* D8 o! R, ~3 T6 B, _
  23. */
    $ Z$ Y( K# S& R: N5 i6 P% D/ {& L
  24. ; `" ?& ?+ g, }/ l' s
  25. #include <linux/module.h>8 y" k4 x5 k% H' @) D$ I
  26. #include <linux/init.h>) T5 {+ q) O7 W0 q. g! q8 a
  27. #include <linux/errno.h>/ B. @" }) `0 {. ]
  28. #include <linux/types.h>
    6 d6 T% K4 X% H% K: {( ~
  29. #include <linux/interrupt.h>
    % q  `' Q4 b, Z- N
  30. #include <asm/io.h>
    ) p4 V2 X7 b. d* v' {( Y% U) d7 v
  31. #include <linux/moduleparam.h>
    3 U9 J7 o; \  o# f2 a# y
  32. #include <linux/sysctl.h>
    " N" F" M" n& l: O1 `2 y, G9 X
  33. #include <linux/mm.h>6 R1 A" U) p8 [8 ~* B5 y
  34. #include <linux/dma-mapping.h>5 }" C9 F1 a2 Y5 b: d' r
  35. : s! [* B" W9 S+ {- U& I! [
  36. #include <mach/memory.h>
    " X9 e* O' w. p3 Z
  37. #include <mach/hardware.h>
    " _* K6 V& i0 ?8 V0 M/ Z
  38. #include <mach/irqs.h>
    0 z; c$ k" a) y# Q' Z& p
  39. #include <asm/hardware/edma.h>
    8 |- p4 d" K; O& ]7 H

  40. $ C  J2 D, ]) {& t7 n, t
  41. #undef EDMA3_DEBUG
    : i$ w" X& C  \3 w. e2 W) O
  42. /*#define EDMA3_DEBUG*/
    9 H3 r  Z+ w; q
  43. $ K1 I( p0 A' p7 q8 {$ A
  44. #ifdef EDMA3_DEBUG/ m; P4 w; `/ I/ D7 ~7 }+ D5 h8 X
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)0 m5 Z, h( k- Y& s. t
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)' _( n6 G- @" y
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    + D8 i" k0 Q' G8 s( j! V
  48. #else
    2 m! |$ D# a' Y6 e" l" f
  49. #define DMA_PRINTK( x... ); B( g5 e6 C, j( V; s7 ]
  50. #define DMA_FN_IN* X0 S' `8 L; @
  51. #define DMA_FN_OUT
    1 ~" l9 E, V) o& K6 G* U5 C* W
  52. #endif6 E( D5 J/ s5 r: m4 O
  53. 9 S$ ~, n% r* m& O* K9 t
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    7 ?. I6 }( m% I  [+ H3 Q
  55. #define STATIC_SHIFT                3
    + d! L/ p/ `4 b" ?# A0 u
  56. #define TCINTEN_SHIFT               203 p( |# M5 B; V4 N9 m! w* Y
  57. #define ITCINTEN_SHIFT              21) m: l8 T! n$ r+ f
  58. #define TCCHEN_SHIFT                22
    " U. B9 P8 i! ?* g
  59. #define ITCCHEN_SHIFT               23+ p! t+ Q8 n, J6 ~. F& }2 x

  60. : ?4 i4 R& t. w! m9 x% |+ l
  61. static volatile int irqraised1 = 0;$ ]& K" ^( h2 Z
  62. static volatile int irqraised2 = 0;  L  f2 V$ Y. a* S- ^6 `
  63. 4 I9 T9 A" s3 W3 m
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    5 W1 m2 a8 e1 i  X
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);% |. c* T# q/ B2 u
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);5 L8 v# e7 Q: U; n
  67. 8 @% p5 u/ k5 x8 o/ V3 j
  68. dma_addr_t dmaphyssrc1 = 0;
    $ J% l: s1 t9 ?6 X9 A) ~% G/ ~
  69. dma_addr_t dmaphyssrc2 = 0;
    8 ?  u4 F* p, ]/ F* l; f
  70. dma_addr_t dmaphysdest1 = 0;+ O( R* R: Z  V2 f
  71. dma_addr_t dmaphysdest2 = 0;4 n! O( j, N0 s) N% x8 |

  72. 5 f5 K4 l$ p, D- K
  73. char *dmabufsrc1 = NULL;
    5 Y: v3 w8 d! D' A( D3 r
  74. char *dmabufsrc2 = NULL;) [  M3 J) @: [7 Y0 b
  75. char *dmabufdest1 = NULL;( A" {4 _0 w1 t* e! a  i- f4 `
  76. char *dmabufdest2 = NULL;: G# Q3 Z5 n$ g* g8 ~
  77. 1 N8 P5 |2 A! {7 J/ B
  78. static int acnt = 512;
    0 p& [# K1 e# r2 K9 Z( F/ P
  79. static int bcnt = 8;' Y' w, _) w/ w
  80. static int ccnt = 8;3 l1 M1 ^7 f  t6 Z* \) T# M

  81. # [+ s$ e! b: j* B) F/ a) K/ N
  82. module_param(acnt, int, S_IRUGO);
    ) s* L- |( n5 W4 w  ?
  83. module_param(bcnt, int, S_IRUGO);
    / i6 y$ \, _  M
  84. module_param(ccnt, int, S_IRUGO);
复制代码
2 S# A' q2 f$ Q. K
5 `* P8 x7 Z7 h
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
* D+ I' _4 Q1 R; N" D/ b' uarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。- O" q: i% c. b% |
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。! \# `% J" ?' V$ i* w

  t+ O; b9 x/ Z1 I# D0 Z7 C- h
8 D7 u% u" F7 F! q# ~6 {. B
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则


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

GMT+8, 2026-1-12 07:37 , Processed in 0.039344 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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