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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
; S# n) b1 s5 e6 o* e5 o
  1. [code]EDMA sample test application
    3 G7 s, |4 ], J* i* U) V
  2. /*
    + k% S9 h) H! L$ p
  3. * edma_test.c
      C2 J/ C! o+ ?# \
  4. *
    , L5 D& E! N7 v3 Y3 q: S, S9 \
  5. * brief  EDMA3 Test Application
    1 L: R8 I( k( B! ~5 t: l
  6. *6 `1 n) y- C: S
  7. *   This file contains EDMA3 Test code.: U+ |) Q$ C7 t7 j0 x& {
  8. *
    0 r& n! v' u* F4 G; I- v; U% i
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE$ `5 Y& l1 h0 ~/ ]0 ?8 P& T) ]
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT; X% D' a2 @. l* Y5 h
  11. *         TO CHANGE.
    , A' ]. N9 @6 R# S7 s" {# U
  12. *
    ; i! n( y3 W- @2 T
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/( v8 s2 l6 U: e& k- Q& A  _* t
  14. *
      ]2 G( h( c: v: U& {% N5 _
  15. * This program is free software; you can redistribute it and/or7 r0 W5 ?* X9 x% c
  16. * modify it under the terms of the GNU General Public License as/ U% L+ ^: C* V8 S' v1 z& G) V
  17. * published by the Free Software Foundation version 2.2 z, H0 H! N7 Q9 z) j# \0 O
  18. */ {* R) r% F- u3 w9 o" V) J
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    , `* i2 h! d+ l% t7 W5 X
  20. * kind, whether express or implied; without even the implied warranty
    2 \  S$ C, @6 k/ _! @
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    * l2 x$ e% R6 I3 w
  22. * GNU General Public License for more details.
    2 Z6 e4 ?$ l2 |
  23. */' R" I0 j: T+ Z/ M# z( r
  24. / k5 k4 E6 w( e+ D: G, z( f6 z8 H
  25. #include <linux/module.h>$ v7 v6 C- c) w. Y9 K
  26. #include <linux/init.h>
    4 B# F( `* Y3 y  W" p3 ^
  27. #include <linux/errno.h>! l2 E9 t- w  R4 o2 _8 T" n; p3 l
  28. #include <linux/types.h>, t6 w6 b  _$ o( B- Q
  29. #include <linux/interrupt.h>0 J. I; l# j9 h& @& J7 _
  30. #include <asm/io.h>% K" K2 y# w5 e  s' R$ M
  31. #include <linux/moduleparam.h>* l3 g; w# X) `& b; O9 g
  32. #include <linux/sysctl.h>
    1 D! z/ ~3 o  U( d2 `
  33. #include <linux/mm.h>
    ! W! U+ u2 t& W, {7 K( @* J5 F
  34. #include <linux/dma-mapping.h>: |9 Y, s1 P. e

  35. * X+ h5 n1 |! m3 k1 [3 f
  36. #include <mach/memory.h>  Z% W2 \5 Y9 s1 Y1 S  j
  37. #include <mach/hardware.h>2 [! R3 [6 G0 Z2 E2 u2 N
  38. #include <mach/irqs.h>" x/ o$ E3 X% s  ^* S3 U9 L9 z
  39. #include <asm/hardware/edma.h>5 z' q1 H# E% X. S+ X  m- C4 t( t
  40. ! W4 `0 F5 n, ^- \% T$ q
  41. #undef EDMA3_DEBUG
    + R6 a0 B* v' C7 k9 e
  42. /*#define EDMA3_DEBUG*/
    % h/ N* \! \3 d6 _( {, R
  43. % _8 \/ n- ~( O) ?" b! G
  44. #ifdef EDMA3_DEBUG  Y5 i9 p3 ~5 g. ]; a
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    ) B% }( Q* C" p7 ?  r
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    # W9 K- t- p" ^- H
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    , T1 O" r% Y' P6 m/ g* A' A7 N3 x
  48. #else, D  u+ K7 P7 L" m, [2 F
  49. #define DMA_PRINTK( x... )
    8 X; K1 N: G9 W0 [2 j9 G: ~6 f
  50. #define DMA_FN_IN4 j& {, V6 d+ F4 p% l5 e8 h6 M
  51. #define DMA_FN_OUT: h3 p' o" {+ s1 r( r/ l
  52. #endif
    * O; d, x& M. h2 B
  53. ) T( ~( j; ?9 g
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    ; C2 [6 B8 `7 d/ c& g7 P* T/ X
  55. #define STATIC_SHIFT                3% N$ O; S: O6 T' G- Y
  56. #define TCINTEN_SHIFT               20! }1 `* N& L; q0 T/ @6 x' v; Z
  57. #define ITCINTEN_SHIFT              21+ \9 E2 l. _; m6 X/ }
  58. #define TCCHEN_SHIFT                225 [* Y# I" E3 h
  59. #define ITCCHEN_SHIFT               23
    5 D8 Q0 h/ `1 i

  60. 7 z5 }6 W' q; N
  61. static volatile int irqraised1 = 0;
    ! n" }8 L5 o* [" \! Y7 x
  62. static volatile int irqraised2 = 0;
    ! f" K. G, Z3 B& r& f
  63. 0 m& E3 G( b& @9 ~. h9 \3 E' v
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    : F. Z% L' a% @2 O
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);+ K* _( y- s/ U* A9 t+ h6 s% }. I
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    / q8 N' o$ n0 X7 \7 N
  67. + @/ ]# k% ]2 s3 }6 C5 p, y, O
  68. dma_addr_t dmaphyssrc1 = 0;
    1 Z: F  n( G) z! `
  69. dma_addr_t dmaphyssrc2 = 0;7 X& W7 G; w: z( }
  70. dma_addr_t dmaphysdest1 = 0;# C2 G* S# ]6 ^  o
  71. dma_addr_t dmaphysdest2 = 0;
    9 ~  i- ~8 C) o. \

  72. , |8 X4 M4 e' D) |% d
  73. char *dmabufsrc1 = NULL;" h2 j7 E. a2 ?% g3 V  C# m; I5 B
  74. char *dmabufsrc2 = NULL;9 n8 b0 G0 D' i$ i5 C
  75. char *dmabufdest1 = NULL;: R/ v( r# F/ u, v
  76. char *dmabufdest2 = NULL;
    " u$ d6 c4 R' [( \* @" U

  77. , y1 V0 a* j  k7 w- `- o
  78. static int acnt = 512;
    1 K$ I: Y* l2 b# I3 i
  79. static int bcnt = 8;
    7 j' }0 j: S% S$ @, f
  80. static int ccnt = 8;
    3 s7 s/ z) g* T! o
  81. 1 D9 v0 w6 O  a, K. f4 K  l
  82. module_param(acnt, int, S_IRUGO);* X2 v  t4 [, d
  83. module_param(bcnt, int, S_IRUGO);! @& C$ g: {4 i7 Q/ C% j3 @9 j
  84. module_param(ccnt, int, S_IRUGO);
复制代码
& G8 _# b+ }% p: y( M5 ]+ _2 R- k5 f

. ~# y4 n# ?2 E; j      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用9 ^8 F5 V/ W+ L$ z2 w4 k3 U- o
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。3 s2 Z3 x4 d* }7 \( a' j
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
1 h; H5 q' }# v' R! H* B# q1 C
8 |" e* f! W/ `4 j0 ^% A( r# Z6 G% Q7 N* m; ~
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-3-24 13:41 , Processed in 0.039248 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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