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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 3 U5 |- p( w0 C! M  _4 ~
  1. [code]EDMA sample test application% Y! t) c5 o8 I- X
  2. /*
    2 l5 j# ^6 u2 L* h  {
  3. * edma_test.c
    7 J* N( }* `" t; I
  4. *8 a) {0 {6 C, J" t- ~
  5. * brief  EDMA3 Test Application, N  j- ~* `% Z4 S( V; Z6 f$ Z
  6. *5 n8 ^3 B* O' y/ i7 }! h" n+ H
  7. *   This file contains EDMA3 Test code.8 d* C/ t* r2 J
  8. *
    6 X& V; Y- `; R$ Z% _0 @" @
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE! {/ x1 M2 Z# d3 I
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT6 _5 Z* ]/ j. k
  11. *         TO CHANGE., ?& P1 D$ g- e- @
  12. *
    2 p2 h( w2 W% m$ j$ n+ C
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    0 V1 W( w# Y7 Q7 e  Z
  14. *
    + ?2 r) T3 U) ?: {
  15. * This program is free software; you can redistribute it and/or
    5 n) r% V' u- ~& s
  16. * modify it under the terms of the GNU General Public License as) {6 r6 F! k$ t8 a
  17. * published by the Free Software Foundation version 2.; b+ w7 W- |2 e
  18. *
    3 P& c2 {" a0 ^# X9 w, f* V* W
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    + }& a3 n6 D# f9 T5 _
  20. * kind, whether express or implied; without even the implied warranty+ F6 g' h% t* V# V
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the( G, J/ o  {9 ]  D, p
  22. * GNU General Public License for more details.
    6 E% x* e6 ]" E
  23. */
    & N# ]+ D5 M/ o0 p9 E

  24. + J' b0 J0 ]5 d# ]8 ?* }
  25. #include <linux/module.h>2 h; t, ~* `9 N! z9 X) X! ?
  26. #include <linux/init.h>
    7 Y4 V5 z+ n7 x* s( P" D: K
  27. #include <linux/errno.h>- q; F$ U4 u9 x
  28. #include <linux/types.h>: X9 J8 H: x( s# {: g" k
  29. #include <linux/interrupt.h>5 j2 i+ b- p3 P
  30. #include <asm/io.h>
    4 [. c7 E3 j7 x
  31. #include <linux/moduleparam.h>
    # R% P- V; h' y7 Q- Z
  32. #include <linux/sysctl.h>
    1 S6 x5 l) \7 F& m
  33. #include <linux/mm.h>: r* l: s$ J* i# f
  34. #include <linux/dma-mapping.h>
    . ?7 j: w  u+ d5 P6 }
  35. 6 R8 |/ S& A& c9 Y7 S' m+ G
  36. #include <mach/memory.h>
    ) _; M3 K  e/ d% T
  37. #include <mach/hardware.h>
    1 d9 I; v3 j/ G
  38. #include <mach/irqs.h>
    3 ~! t+ g: F0 `
  39. #include <asm/hardware/edma.h>3 i/ X7 s) R2 ?; k

  40. + o: e! E9 B9 t+ v
  41. #undef EDMA3_DEBUG2 C# J! {* a: V! z! P7 z
  42. /*#define EDMA3_DEBUG*/
    % ^/ H; E! C. z$ g6 p7 d, l
  43. 1 |* c; H) L) _3 f
  44. #ifdef EDMA3_DEBUG# ^8 K  N& g/ Y( w) s5 G
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    . L' b+ f) D' e" O6 p, k8 _* \
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)  h  t3 T8 ]( P
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__): g8 C; i( m. x7 e# L/ T& H% y
  48. #else- `, N  L/ m) J! z
  49. #define DMA_PRINTK( x... )- k3 y( D; W( v0 t" o. a
  50. #define DMA_FN_IN
    : N4 a/ Z' c& ]% W/ |& q
  51. #define DMA_FN_OUT* V% Q2 ?( s7 K
  52. #endif
    ; Z3 C5 w4 C- |/ M8 ?( _8 ^( {& {
  53. 4 C; z$ U! s# w+ v7 x( @
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)7 R! k  J5 r) X
  55. #define STATIC_SHIFT                3
    ' H2 T+ g/ K( F7 g) i3 b
  56. #define TCINTEN_SHIFT               20
    ! e# r7 n2 l& @8 N1 V9 c
  57. #define ITCINTEN_SHIFT              21
    1 P9 a7 b3 c$ g* M5 @
  58. #define TCCHEN_SHIFT                22
    ! `4 Z2 e8 `. t
  59. #define ITCCHEN_SHIFT               23; h4 T  |% Q  Q! w
  60. + _; b/ R- _3 E
  61. static volatile int irqraised1 = 0;  |( M" `% z2 q  [' S# Z5 \. |* ^6 G
  62. static volatile int irqraised2 = 0;7 A2 ?' @1 e  F* H

  63. 9 ~/ |; D5 E3 y1 @: J* f
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);. S; [1 N& z' X$ W" Z0 ?
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);7 M$ L% s* o5 {
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    % L8 Z  d/ C  H, [4 a0 B  u2 |, f$ X+ m

  67. ; P' |+ p" D/ ?/ M/ y2 _
  68. dma_addr_t dmaphyssrc1 = 0;* O4 ?  z& w! C" T7 ]+ i
  69. dma_addr_t dmaphyssrc2 = 0;
    # h7 m) v5 L' k
  70. dma_addr_t dmaphysdest1 = 0;3 w& x( r' N% X# u) P& `  C% x
  71. dma_addr_t dmaphysdest2 = 0;
    0 s2 k4 @* y6 Q2 d/ u  _

  72. * \: w: t& \" ?: q% m  J+ I
  73. char *dmabufsrc1 = NULL;/ x& X3 \6 {* \
  74. char *dmabufsrc2 = NULL;
    8 O, C. r, M1 I, f+ K; @3 Q# a
  75. char *dmabufdest1 = NULL;" Q$ E9 _% w1 y: b" F
  76. char *dmabufdest2 = NULL;. U- u! ~! U" e

  77. & r, s' Z5 l3 f$ W* a/ _! B' Z
  78. static int acnt = 512;
    ! Z3 Q3 ~# Y$ s' n& B
  79. static int bcnt = 8;' O# U- n- B0 m3 K; k  y  J# D
  80. static int ccnt = 8;
    # x( R5 n. [; z* |) Z6 @+ Z

  81. 8 M; l5 Z0 Z9 V4 q* z6 x: `
  82. module_param(acnt, int, S_IRUGO);& \8 d1 `- J; o+ D' T
  83. module_param(bcnt, int, S_IRUGO);! P$ w0 B! V2 O) l
  84. module_param(ccnt, int, S_IRUGO);
复制代码

( ?* u: s! O1 ^" H! `
. C# ?! |% ~4 j% h( s" J" H      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用: E! j0 r5 g' d; N0 \+ u1 ~
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
# Z0 y8 p. Q% v. d& I4 ^/ j+ e: A     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
+ z, x! L3 Y1 O  L2 x- i5 }( u5 v  R( k+ p" Q; a- K& r. i: d
8 x  g# R' _, e& w$ O! }
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-1-18 16:04 , Processed in 0.039401 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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