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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
2 m* O7 O) W9 H
  1. [code]EDMA sample test application
    ' _) J4 Q/ U* i4 ]$ \+ {+ _
  2. /*  X! K, a, T- F. V2 j; ?
  3. * edma_test.c
    9 e3 t% U3 l, Z* @: Z/ V/ c
  4. *
    8 Q) ]9 ]  V! Y( o! l- K2 D, O
  5. * brief  EDMA3 Test Application
    9 |0 L4 @) z! g. q' W
  6. *
    - V4 \; \8 O4 E, o2 A9 c
  7. *   This file contains EDMA3 Test code.
      P  [8 P* [. \& J2 C/ e5 r' F& ~
  8. *3 M# Q; e, |! C! u: J
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    4 r3 `' p( `- m) i
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    + Q/ x8 l% F( y& P2 d
  11. *         TO CHANGE.
    ' ~0 g3 n2 y* _
  12. *
    : y6 w$ y7 j% Z. i. d
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    # g* a( o, ~& u: \( O
  14. *: \& [- F. e7 n5 k4 j2 u' w' Z
  15. * This program is free software; you can redistribute it and/or2 e' y% `8 j) I4 [
  16. * modify it under the terms of the GNU General Public License as
    # G1 f  H# _* w2 H9 s$ B+ L$ C
  17. * published by the Free Software Foundation version 2.; B/ V5 e$ T" H; G6 }9 `. e
  18. *
    5 _1 o6 m/ o1 T7 u- T# b6 ]7 a5 `
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    # v, q: ?( L, r0 g6 F  n
  20. * kind, whether express or implied; without even the implied warranty: S4 i: I% g: O  V+ |4 \/ p
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the& U7 F9 Q9 E' w: Y( X% Z- I; e
  22. * GNU General Public License for more details.
    2 x/ y9 p% }  F/ a& w3 v' n
  23. */
    2 F8 Q0 `" V* v1 t. n

  24. $ ?3 {( ^8 E  M4 `% t% X% n# {
  25. #include <linux/module.h>
    ; M9 d+ L, ?! _$ ~8 |- v: X1 S
  26. #include <linux/init.h>6 b  |  K  S: i; v* c; F! D
  27. #include <linux/errno.h>
    % \* A  w- s, [' y& r# e* V' F
  28. #include <linux/types.h>
    ) }9 F9 B- s! E- E
  29. #include <linux/interrupt.h>5 }: G& K4 m9 k- w7 s  N: ~! C1 U. ~1 U
  30. #include <asm/io.h>
    1 z( r/ y; R' D0 S
  31. #include <linux/moduleparam.h>$ ~9 n, Z. Q0 Z7 Z6 i' ?4 e; _
  32. #include <linux/sysctl.h>- n/ a' ?; e( O$ q2 x
  33. #include <linux/mm.h>
      L- Z" ^4 M$ R* B4 N8 z
  34. #include <linux/dma-mapping.h>8 e0 O# L- K5 Q/ w# j0 c$ F8 y
  35. 4 m; K  t. s: R! d
  36. #include <mach/memory.h>8 x' }/ r( D: S) E3 G
  37. #include <mach/hardware.h>' \; |! G/ U9 T- p
  38. #include <mach/irqs.h>
    ) K4 U4 |" I1 n
  39. #include <asm/hardware/edma.h>  N$ ^5 u: ]- u9 z8 p: ^0 S- B

  40. ) Y  Z+ r% s# h) ^# u4 x: Y
  41. #undef EDMA3_DEBUG( R- R0 s% l" r; C0 i' {
  42. /*#define EDMA3_DEBUG*/( h4 Q% Y0 V3 w

  43. 4 a% S, W7 {4 S! f
  44. #ifdef EDMA3_DEBUG! M7 M  ]; ~4 H6 g2 b
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)3 b% v  ~7 z4 J9 g! D/ \6 H
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    % T" S$ L3 W6 P* }  Y( G/ S
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)! W' N  x0 S+ p) X7 [/ S2 B. D9 _
  48. #else
      U& L* ~$ a: c6 G
  49. #define DMA_PRINTK( x... )8 I0 A: }* V1 }
  50. #define DMA_FN_IN
    $ e, I4 P7 m$ H  W) X0 u$ n0 H
  51. #define DMA_FN_OUT: i3 i1 O' v9 Y0 Q/ ^
  52. #endif
    - \5 s5 e1 m# z; X% l; X

  53. 0 f9 r6 s& K; B* V0 g
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)5 {: o$ k7 n0 N/ j& @) P: I: r% E
  55. #define STATIC_SHIFT                3
    2 a; `6 _4 i) I. v8 G
  56. #define TCINTEN_SHIFT               20, O. M1 E: H* c* w
  57. #define ITCINTEN_SHIFT              21  k# B& _& K( g# x- Y, h( I
  58. #define TCCHEN_SHIFT                226 R. g' t1 j, g/ Y! M
  59. #define ITCCHEN_SHIFT               237 E! c  N( ~2 m# E$ M' \

  60. ' D& e5 H6 M3 c* `( P4 b$ E
  61. static volatile int irqraised1 = 0;
    ; Y0 o9 w! d% h1 \4 b' L. L
  62. static volatile int irqraised2 = 0;9 w5 @2 A/ J  h' e3 g2 S
  63. 3 g7 C) ]$ `. o! n/ h( K" q
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    1 Z' H; V, ~3 U
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ) N1 b! ~& w0 O; E3 C3 `+ m0 ~
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    . C9 y0 S0 X$ Y* m3 O' W- @

  67. ( O0 g8 `, y3 C1 V7 c
  68. dma_addr_t dmaphyssrc1 = 0;
    $ n/ G" Y' i- a8 s9 b3 O/ w
  69. dma_addr_t dmaphyssrc2 = 0;( `% t+ i6 ~: r
  70. dma_addr_t dmaphysdest1 = 0;
    & S  X. p& H2 `, b% ]6 c7 @( f
  71. dma_addr_t dmaphysdest2 = 0;$ I& ^; i; F6 b+ l! P3 n' R' x( r
  72. $ t+ a6 v' M& i: Y/ {2 l! M
  73. char *dmabufsrc1 = NULL;
    2 c6 F5 D% y( @* @
  74. char *dmabufsrc2 = NULL;
    4 D1 \0 `, ~, p: O& H1 _
  75. char *dmabufdest1 = NULL;
    . G* D9 o0 `$ {
  76. char *dmabufdest2 = NULL;
    - U6 i4 S( h( E8 p- x, V* I+ E! D

  77. ) _# `$ s+ a% N. I: T# a
  78. static int acnt = 512;" j, F1 S: Y: o8 E2 |
  79. static int bcnt = 8;
    % @/ k5 K. z- }1 {9 {  k( a' w
  80. static int ccnt = 8;
    + f; A1 h! W( ~1 s
  81. 7 h. [" M- r6 q9 N
  82. module_param(acnt, int, S_IRUGO);
    2 X& T- D" z3 O6 J6 E4 l0 G
  83. module_param(bcnt, int, S_IRUGO);
    ( Q* r, P+ M3 r
  84. module_param(ccnt, int, S_IRUGO);
复制代码
- y8 Z1 y! _& B) B+ a4 G
% ]$ v! T9 ~% w9 b) ~$ J# `0 z, X3 H
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用! {% z0 x) V2 Z7 R
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
( L  N+ o. `# b0 q4 H     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
% A4 w5 D7 Y* N0 P9 r/ L; c4 V3 B0 |' i4 y% @, ^3 }! |* c

# s5 M2 Z& p. |
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-1-21 02:34 , Processed in 0.041425 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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