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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |正序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
$ n3 Q* e) R* z
  1. [code]EDMA sample test application
    0 [4 z: d0 ]  K' Z. c6 b
  2. /*
    0 P" _, V5 `$ B3 ~* G/ L# T
  3. * edma_test.c8 _! ~+ z+ m$ E. @, Y1 N
  4. *1 U  P4 E6 m) H/ w. u# k/ u
  5. * brief  EDMA3 Test Application, e: a; M. y. H" r9 l1 ~3 L
  6. *  S) R1 J; E6 J5 y# b
  7. *   This file contains EDMA3 Test code.
    9 l$ n2 \3 O' D& G+ L- ~
  8. *
    9 T- H) w, A  ~
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE# n# V! a; z; B* m
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    $ u/ h: X* |2 g; e
  11. *         TO CHANGE.
    : I/ w  C% s8 a/ c
  12. *" {' T% J2 {& N, L
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    + W2 D5 b( M& D7 y# {# q( z
  14. *
    % f  q0 ^% l) t+ |9 o
  15. * This program is free software; you can redistribute it and/or, z* P' e& \7 w2 i* A5 H$ C
  16. * modify it under the terms of the GNU General Public License as
    ( t0 ]& [% }% Y: X9 O
  17. * published by the Free Software Foundation version 2.. L- ^$ i3 n' k' Y: d- s) O7 ^
  18. *
    + z3 y" b8 v# c: v3 B
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any# A: a1 Z% Z" D$ \4 I4 B/ l1 s, k
  20. * kind, whether express or implied; without even the implied warranty
    : l4 g- _1 M4 \
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the, n) O' C/ j6 u4 H
  22. * GNU General Public License for more details.; m0 b0 F' I3 H2 D5 c
  23. */8 s; M* v3 _1 J' j5 f

  24. , |0 p8 H; ~0 K4 _3 d' Z# x
  25. #include <linux/module.h>$ v( |' |! H6 b: ^0 H
  26. #include <linux/init.h>
    ; _& I( e; v" w5 O7 f2 h
  27. #include <linux/errno.h>7 w$ n( O% P& [' U8 _
  28. #include <linux/types.h>
    3 \9 o$ K" j" @' }' C" s/ i
  29. #include <linux/interrupt.h>
    # s4 x0 V9 C% ?; U+ i
  30. #include <asm/io.h>& V3 j* C4 g8 e8 X
  31. #include <linux/moduleparam.h>: n7 S3 W! R% a
  32. #include <linux/sysctl.h>
    # i' e5 B) C6 D2 Y1 x2 r( H
  33. #include <linux/mm.h>9 ^( I& ^1 u+ l1 x( ~) g6 H  g7 \
  34. #include <linux/dma-mapping.h>  {: r1 x6 S# L" j+ _; B0 B
  35. 6 L$ p  j) `% Q+ D3 @" b. ]
  36. #include <mach/memory.h>
    4 J% ?* l8 B& o
  37. #include <mach/hardware.h>
    ( t9 N) O' r* b' z7 v- o8 A. U
  38. #include <mach/irqs.h>
    8 h, c* K# ^" j7 x
  39. #include <asm/hardware/edma.h>
    $ |/ c9 q5 }, u: E: v: n  {

  40. 9 Z: p4 f" y- q/ P8 U4 [* d
  41. #undef EDMA3_DEBUG
    , \$ ~% I9 ~- L3 x6 R, \3 `# N4 M
  42. /*#define EDMA3_DEBUG*/
    7 Z: i1 b4 W, u8 @

  43. 1 w4 s4 {' t8 m4 Y3 }/ c/ H* W( g( v
  44. #ifdef EDMA3_DEBUG
    " A* T# U8 `8 s5 U& _" }
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    0 i$ W5 H& {4 [8 E3 {2 T5 s; F, t6 Y
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)3 |  \1 {  Z8 ~' P1 V$ Q
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    . ?( P% C6 e/ d+ d
  48. #else
    3 o* s6 P/ J9 I. C
  49. #define DMA_PRINTK( x... )
    5 u8 D) g1 W8 ^2 m9 t
  50. #define DMA_FN_IN
    1 m4 P% y5 ~# X9 J
  51. #define DMA_FN_OUT
    : n2 t) R& d0 k6 _2 C! J8 \
  52. #endif
    + O0 {' Q! K, Z$ q8 P
  53. * S2 M! o0 ^  W1 P+ e- {. b' Q
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)! Z5 \, V7 q& V: U
  55. #define STATIC_SHIFT                3
    . Y. E' W4 p; Q
  56. #define TCINTEN_SHIFT               20
    3 I7 r0 R+ Q, p9 w  o& H- p) o. y
  57. #define ITCINTEN_SHIFT              21' m1 U0 X8 k8 w+ P
  58. #define TCCHEN_SHIFT                22% c! n4 b$ l( j0 T6 J
  59. #define ITCCHEN_SHIFT               23
    5 L8 L, c. X6 x3 L

  60. ! K5 a# k0 S- I
  61. static volatile int irqraised1 = 0;
    - a' F6 t, n- n' d& V$ e) h
  62. static volatile int irqraised2 = 0;7 C/ n' p  K( g

  63. ( |8 w8 e; l5 H, }3 I
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    . P; f* v! y4 \) d6 t" k4 z4 T" \
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);/ }6 |) [" b' ?. z. {/ A
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);- [0 D7 O- N% C" c  y  ]8 |

  67. 7 [! I9 n0 ~+ h* L! J# ~
  68. dma_addr_t dmaphyssrc1 = 0;) c9 B3 t0 n5 V3 `7 g' r1 {3 Y
  69. dma_addr_t dmaphyssrc2 = 0;) x7 Q2 _( I4 P, ]7 ~" V# ]& o
  70. dma_addr_t dmaphysdest1 = 0;
    - K6 G+ d* }2 c# d
  71. dma_addr_t dmaphysdest2 = 0;/ M/ K) B: F: u5 K* s% u

  72. " y& ?' e0 B6 m6 |% k
  73. char *dmabufsrc1 = NULL;0 W/ n' ~9 H0 M3 o! T& m
  74. char *dmabufsrc2 = NULL;
    1 S& b4 z7 y# e; Q3 p: }  h. g
  75. char *dmabufdest1 = NULL;
    & j! ^% z' _& h
  76. char *dmabufdest2 = NULL;
    3 ?6 J7 c, G! P9 P9 _# F

  77. ( ^( _  ~1 Q$ h9 @+ y5 ^
  78. static int acnt = 512;' Z4 J7 u$ ]6 q- ~% s/ r
  79. static int bcnt = 8;
    ; {7 D/ F/ g% g/ k$ [3 Y, c" O0 ?0 M
  80. static int ccnt = 8;$ q6 s$ r' Z! U8 v$ }  m: L. y

  81. & k$ J' m, M$ {% F- [2 N: w
  82. module_param(acnt, int, S_IRUGO);# s- t5 t5 ~% C' d1 u
  83. module_param(bcnt, int, S_IRUGO);% e/ |* @3 }- q: O) ]: e
  84. module_param(ccnt, int, S_IRUGO);
复制代码

/ u3 F! U' S  @) @' H4 _" J1 B% f/ [5 ], L6 [
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用& t  N5 d* A( H
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。- i" p9 l, Y( \/ A* t
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
2 ~* \" D$ r" B& d1 b" O- _- {( F; h) |" q( P$ e

: f3 G2 C* T0 I* d
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-3-5 01:12 , Processed in 0.045815 second(s), 28 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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