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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 . D7 [, U: q! a2 e( z
  1. [code]EDMA sample test application
    3 t/ Q, }# W5 u$ k; ^9 p
  2. /*
    6 ]# m" ]1 {" |
  3. * edma_test.c. F& E$ Q) @% G$ R" c  Y
  4. *
    ) M  w" O4 h" N) `/ ?9 A: `9 Q9 v* }
  5. * brief  EDMA3 Test Application0 |: L3 M0 @& b
  6. *& U) c- B5 T# K. l! f
  7. *   This file contains EDMA3 Test code.$ j8 Q1 E: i. l& t
  8. *
    . U. f5 r" o# Z& |
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE* a) v) v) f6 ?4 y
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    5 I0 e7 K$ v  r% s* C
  11. *         TO CHANGE., I; y1 l. F: ]' X$ U
  12. */ g% k. n8 d( J6 g0 a' g! |3 x
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/* B! E( D  p  G$ [) Z; T/ k, S# ^
  14. *% c: ?  L: \! @; n
  15. * This program is free software; you can redistribute it and/or
    5 X5 F+ F, w- g: U9 ]1 B( H0 L
  16. * modify it under the terms of the GNU General Public License as
    1 S: R! Q0 b* v1 c$ f" G
  17. * published by the Free Software Foundation version 2.
    : d& b+ a0 ?. T3 k
  18. *
    . ?$ M/ X5 G. Y4 c2 Z0 j. \
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    7 j* ]& Q9 ]7 s
  20. * kind, whether express or implied; without even the implied warranty) J8 t% g2 h3 A2 w/ F6 d
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the" j+ B' ]' ~( d
  22. * GNU General Public License for more details.- _$ g7 B" z5 s' B4 f( L+ t1 ]( d
  23. */
    + N5 k5 T$ p$ Z9 o. U
  24. 9 K0 H9 }8 J3 v$ P! F+ T1 A3 D
  25. #include <linux/module.h>* u* D+ [& @8 _/ i: Y
  26. #include <linux/init.h>
    " \2 @$ v& ^3 S$ a
  27. #include <linux/errno.h>
    ; u# H: s7 X2 H. \! `% w4 [
  28. #include <linux/types.h>
    ( x0 C+ \2 q3 P% h: B- L( O, K; T
  29. #include <linux/interrupt.h>
    - ]9 B& M4 S% J3 {4 U$ L: |
  30. #include <asm/io.h>
    , E5 ^) A5 [3 x, I2 v) }3 R
  31. #include <linux/moduleparam.h>
    4 j9 {7 [5 l, o" b  v6 L& k
  32. #include <linux/sysctl.h>
    % T  J% T1 M6 d. h. s
  33. #include <linux/mm.h>
    8 }0 a' C# f, w$ m' ]: M* J
  34. #include <linux/dma-mapping.h>
      Y$ Z* O2 J- r" T: v. Q7 v

  35. ; S6 ~% i1 Q6 D$ A+ @
  36. #include <mach/memory.h>
    3 H$ H# m& o2 p
  37. #include <mach/hardware.h>
    , i( w& r( }* @% ~
  38. #include <mach/irqs.h>
    5 g* c; y1 u( g2 j% S
  39. #include <asm/hardware/edma.h>
    ' N+ V0 R& D5 f8 d

  40. + n3 W3 B8 {/ i* b
  41. #undef EDMA3_DEBUG
    " a1 p5 O5 g: {+ T' T, w; O0 G  R) \
  42. /*#define EDMA3_DEBUG*/, h( x! x# [) s7 K2 t
  43. 9 l, I" Q8 H  Y0 R% e
  44. #ifdef EDMA3_DEBUG; `! ~9 M8 S3 ?; [
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)/ O" n! C; Y0 ?, ~4 @* w" Q. w
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)9 b0 M2 l2 ~9 ?: W7 m1 l
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    / v: `8 o1 m5 H# f* x0 n( J
  48. #else" {$ H/ G3 m6 D2 {% k% g7 Z0 z
  49. #define DMA_PRINTK( x... )1 X) G$ }7 _+ P9 h! c* A6 G) h
  50. #define DMA_FN_IN
    8 j* |5 @* {; s9 E1 c( M* m
  51. #define DMA_FN_OUT
    - _' r" o3 y* r; k
  52. #endif. i1 [" L9 d/ l2 b# `# @
  53. . N7 v9 T, c0 [+ @0 Z- k3 W
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    1 E$ h7 y6 ~0 j8 n5 d
  55. #define STATIC_SHIFT                3$ z( e: d  c& a+ M+ Q
  56. #define TCINTEN_SHIFT               20
    % v8 u. T8 G3 r0 F" q
  57. #define ITCINTEN_SHIFT              21; o, X* n; }4 J! B1 W$ ?/ ^$ a
  58. #define TCCHEN_SHIFT                22" ~. ?! l6 K9 i& p
  59. #define ITCCHEN_SHIFT               23
    + M3 _7 v  y7 o. u/ \$ i

  60. , Y0 q9 K- ^3 n. c' a- v6 [5 {% O# A
  61. static volatile int irqraised1 = 0;* S8 u( v# X: J# e+ M' m
  62. static volatile int irqraised2 = 0;9 d: J/ u" l. v7 h* U; N7 E6 @
  63. 0 f/ N) f# F. x4 w+ ^
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);3 a! f2 O% @9 @, G. T+ J& @
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    6 j+ [1 }; G% X9 @, c8 E
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);' h: j; C) [# x) r. Q5 O
  67. ' w( I1 J; k& m8 M* N7 C
  68. dma_addr_t dmaphyssrc1 = 0;* z8 R- z0 r( t/ a$ {, ]' b
  69. dma_addr_t dmaphyssrc2 = 0;
    8 B7 m3 _) u0 k) J  o3 E
  70. dma_addr_t dmaphysdest1 = 0;
    + ]* H9 B( k( @1 w3 S( R. B' {! D
  71. dma_addr_t dmaphysdest2 = 0;' B' R8 z9 T/ b! d+ m0 s' f, [) ~
  72. : w. X& y$ h" x' ]1 T" W0 n
  73. char *dmabufsrc1 = NULL;
    4 x6 c$ V. K+ g+ g4 C1 `/ F
  74. char *dmabufsrc2 = NULL;' p; }+ K7 K% t1 ~* J
  75. char *dmabufdest1 = NULL;9 V0 f2 w. m% O  ]2 y  [; U
  76. char *dmabufdest2 = NULL;
    + \4 u$ y5 t8 W5 U

  77. . Z$ z- V! v) V+ d. ?
  78. static int acnt = 512;3 P" Q9 {1 V( I0 p5 m, j0 a
  79. static int bcnt = 8;
    4 Z) D+ h8 s& C6 ^6 H+ h
  80. static int ccnt = 8;- k! b; Z! S  Q2 g, D

  81. 7 N2 Q: p5 K7 w
  82. module_param(acnt, int, S_IRUGO);
    % j' z2 X6 U2 }# D% K* s
  83. module_param(bcnt, int, S_IRUGO);! \! a/ f( K0 Z' z* x+ ?
  84. module_param(ccnt, int, S_IRUGO);
复制代码
' R% a( [  ?( q; \- E

6 v4 l% z+ s  }3 h* E9 x      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用! m) ], K7 F" F9 {" W! i
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。5 ?# b: G4 C7 _5 B) G( q8 r2 J
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。8 ^/ D" V3 f, ]9 F
1 d" D6 M9 K2 ^; Z2 y. i
; X  u6 H7 [+ K# v$ c( C! z) |
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-1-30 22:53 , Processed in 0.038452 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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