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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
/ m  K% `& j! a) b& q# O3 z3 e$ v
  1. [code]EDMA sample test application* b, k7 m4 |: F% q
  2. /*
    * Q6 ]/ Y/ b3 V) ]* [2 f+ I
  3. * edma_test.c
    + p! U3 C2 E3 D! @: Z8 W+ p
  4. *8 T4 V4 s$ t6 ^. c% z) v! ?* B
  5. * brief  EDMA3 Test Application
    " w3 v9 F/ t# t& u  U$ I
  6. *
    + @6 V  S" q' v( s
  7. *   This file contains EDMA3 Test code.- @  h1 g7 d( ^
  8. *
    ) q' ~" ~1 T" D- O/ n4 W
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE) u  Y- _# ^' _' M7 R9 E
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    4 g6 y* i5 c- d5 m8 L
  11. *         TO CHANGE.
    ' f0 j% g* f1 e! Z0 w2 Y% S- A! d
  12. *- W5 F0 Q# [( ?* s# [0 }
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/4 b  l8 ^# D6 N, g; [8 P
  14. *
    2 F0 y0 ]2 T# R
  15. * This program is free software; you can redistribute it and/or0 }: q$ \8 ~' ?
  16. * modify it under the terms of the GNU General Public License as
    7 p5 Y0 U/ J& C7 {' Q
  17. * published by the Free Software Foundation version 2.
    " r. \# n6 M) G; _' d! @
  18. *0 ]2 ?* t  k6 y( O
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    2 U* l- E6 y- d( G1 s3 x
  20. * kind, whether express or implied; without even the implied warranty
    " r/ c6 J" B% g0 N
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    % w$ p. D2 U5 j$ O! s
  22. * GNU General Public License for more details.3 o0 ]7 l; o' j4 {2 b2 I! f
  23. */
    . J8 y2 H$ F) Z, m6 d
  24. / a+ {+ ?% E  n2 ]: M% C: q( j
  25. #include <linux/module.h>
    7 Q% ?( a% d& M4 G
  26. #include <linux/init.h>
    . f9 r5 v, ~( F7 w
  27. #include <linux/errno.h>; L: C! J! B7 d8 f: r0 F5 }6 M
  28. #include <linux/types.h>& y5 u6 H5 r% `% D% ?
  29. #include <linux/interrupt.h>0 u8 A" W: z" x5 q; x
  30. #include <asm/io.h>0 T. l3 X/ q8 m* k1 R! b6 W8 c  B
  31. #include <linux/moduleparam.h>
    5 g6 @3 F! Z5 i% H- o+ O
  32. #include <linux/sysctl.h>/ c& [, d6 n* f, i
  33. #include <linux/mm.h>( k$ @% J* e. P
  34. #include <linux/dma-mapping.h>" h3 m6 p) ^! L. Q# t" D1 ?4 _  F" c

  35. : d. r; w2 V+ m8 P* E; E7 a
  36. #include <mach/memory.h>
    / V9 h* C% t! c/ \+ F0 D4 a
  37. #include <mach/hardware.h>
    5 {: [- ^& `0 `9 r' w
  38. #include <mach/irqs.h>' G, W/ L0 ~7 J. s  Z% N
  39. #include <asm/hardware/edma.h>5 m6 ~/ @' c) o0 K  C
  40. 5 P4 F- Q$ Y  _: K% B
  41. #undef EDMA3_DEBUG
    # U' _, ~! c5 V
  42. /*#define EDMA3_DEBUG*/; C1 [/ j' y$ o! U7 R4 j8 H7 K6 }
  43. % P) E  f- S# P9 X- ?+ R
  44. #ifdef EDMA3_DEBUG
    $ M  m$ H, C5 y1 ^, @5 u
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)5 V! g& z1 ~6 b) s" E0 g
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    1 A4 T8 i& U# Q9 d3 z4 V$ j# d
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)5 G5 D2 ]- F4 }8 ^
  48. #else9 n% _" m3 @0 S$ m7 e1 Q+ s7 Q
  49. #define DMA_PRINTK( x... )
    3 C% Q8 a5 W4 _
  50. #define DMA_FN_IN
    2 w. e( u. p7 k# D! U0 Q9 D
  51. #define DMA_FN_OUT) ]& ^9 K. J# I) d
  52. #endif
    ! Q4 S8 e2 y' {0 ~' P9 \8 [
  53.   V, [9 q. F. W$ B$ n6 P# i2 H) b
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)5 ^5 H: A$ T. s" e4 M' r
  55. #define STATIC_SHIFT                3
    8 Q7 {! `/ ~9 s# I/ b
  56. #define TCINTEN_SHIFT               20. x4 g3 _8 l8 r: b! ?% L& {
  57. #define ITCINTEN_SHIFT              213 c5 ^4 G( y+ K: X7 u
  58. #define TCCHEN_SHIFT                22
    1 g' ~% w- J/ H! j
  59. #define ITCCHEN_SHIFT               23
    . T! _2 k, u. l( y2 U! A0 N

  60.   Y7 `* i& {2 U1 {* Y% p
  61. static volatile int irqraised1 = 0;
    $ _* ?: n- B4 q; i" w
  62. static volatile int irqraised2 = 0;3 p* Q4 T. [% p& u* I( ~. I. a4 @

  63. - Y  R5 a: a% e3 k% u2 K& G
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    " M3 ]* v9 A' O9 t
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    7 Z% g6 n9 F8 H, z7 u* z; A
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);1 `2 g5 R) H: o, t, {0 i# _5 d5 L; @& x
  67. % q9 R5 Q) e# ^. D7 P
  68. dma_addr_t dmaphyssrc1 = 0;$ A$ e' E2 N- H- F6 n' n: V
  69. dma_addr_t dmaphyssrc2 = 0;! g, P* W0 B0 `- w7 P3 k# w9 {! a
  70. dma_addr_t dmaphysdest1 = 0;( e  G8 g8 r0 ?! r# a0 M
  71. dma_addr_t dmaphysdest2 = 0;$ ~0 \; @0 H% v# x( w8 t- o
  72. : k8 Z) O4 n% Q( z
  73. char *dmabufsrc1 = NULL;
    $ M7 {, R6 |! f1 x& z
  74. char *dmabufsrc2 = NULL;
    5 f# S" G/ E  `% h# S  b2 o2 R
  75. char *dmabufdest1 = NULL;
    $ j" \  O+ `% a, C) A
  76. char *dmabufdest2 = NULL;$ L5 ?; b$ |' x8 L& X8 ?' e) c
  77. ! y  _& `, g$ C5 j' J
  78. static int acnt = 512;
    3 ?5 X, C9 n/ r3 }
  79. static int bcnt = 8;9 P# S3 i2 K. J
  80. static int ccnt = 8;
      N0 f2 \, B- m% @

  81. 5 n3 C7 E( S  `3 a& {
  82. module_param(acnt, int, S_IRUGO);) t( R, ]" s7 q. L6 g" J4 h
  83. module_param(bcnt, int, S_IRUGO);
    # n  P2 V) F2 U: c1 u! g
  84. module_param(ccnt, int, S_IRUGO);
复制代码
  r1 Q1 n0 E9 X* _9 S& v! T
2 U9 i: d8 A4 W+ e
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用, E/ U" r5 n8 ~) h+ ^$ b2 w- }
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
0 B5 S* `- N9 [( L     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。- l" p0 c$ W$ @2 v1 F- n( _5 q6 W9 [

& N4 [# F: W( F; V
7 s3 A) I5 E6 U/ D( X
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-2-11 11:55 , Processed in 0.045752 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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