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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 2 D* q6 U2 l2 _2 d2 t
  1. [code]EDMA sample test application- n$ j4 r6 E  J+ ?: [
  2. /*
    ) ~9 e; G' K; l5 E% F) k8 |
  3. * edma_test.c
    . Q) s+ \/ S$ ]- j" B: p" \
  4. *: x, V$ a% A+ d. s0 f& X
  5. * brief  EDMA3 Test Application; O8 m8 i( D9 p/ s+ z3 N! @
  6. *4 y8 C; S, g7 X) s9 [5 k; K
  7. *   This file contains EDMA3 Test code.* T/ \9 K& ]1 I% M( F+ S
  8. *! o7 e3 ^' L9 |- ]* \5 r
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE) V, a& n" W- J3 J
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    1 g! M2 K# ~: e6 o. D, T* P
  11. *         TO CHANGE.
    % i; {4 N  h, y& V$ o/ M( H5 A& _
  12. *4 q  @6 d) C: v+ }: B5 y' x
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    4 O+ a' D' E; V- j- D' X
  14. *8 C! I- ]0 }& a1 b4 }- n- m
  15. * This program is free software; you can redistribute it and/or
    . f& Y, [/ i9 S! b, J; \+ n% l5 G
  16. * modify it under the terms of the GNU General Public License as. l4 I9 H) ]. y; P* c! X, R
  17. * published by the Free Software Foundation version 2.
    ! P; K8 X4 U( Z8 a
  18. *) r4 z& b( z, m0 g2 ?% E8 Z
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any, Z( v( {% V% H; h. C
  20. * kind, whether express or implied; without even the implied warranty) E! P' P& b9 i7 Q, N
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    % D8 B5 e: o$ q% N* y: [
  22. * GNU General Public License for more details.
    4 j. h8 o0 L3 w0 q
  23. */" W# [0 r0 J( t& }1 ~
  24. ( L6 D! k& I. @/ R
  25. #include <linux/module.h>
    . ?0 d% N8 u7 J, X+ v9 L
  26. #include <linux/init.h>( p; l" [. K7 E7 _( f
  27. #include <linux/errno.h>& K. v* A1 _" W. D+ C7 m
  28. #include <linux/types.h>
    & d" s4 h" S. t! s6 d' i
  29. #include <linux/interrupt.h>, `5 Y6 O" E8 [! f4 p
  30. #include <asm/io.h>
    $ {0 T+ ]% ?5 Q' a6 p7 b
  31. #include <linux/moduleparam.h>
    ! [' ?' H; @6 |
  32. #include <linux/sysctl.h>1 E* B3 M; j( J, J' n2 O! E
  33. #include <linux/mm.h>
    % j3 b1 V) ~- T8 u' |
  34. #include <linux/dma-mapping.h>
    , |  U' d8 g- d# K
  35. , U  E. J8 }2 v7 K! }% K5 W7 `
  36. #include <mach/memory.h>6 Y, p) |, }( P7 ~. p! z
  37. #include <mach/hardware.h>$ F! [+ W% Y) U% q  {, H7 y
  38. #include <mach/irqs.h>
    : \" V6 w  f) C# w4 M( ]+ d
  39. #include <asm/hardware/edma.h>
    + L, Q" c. s# z2 Q: p+ o8 t" L

  40. ' q. O8 ^6 w: [1 X; m
  41. #undef EDMA3_DEBUG
      s' ]  F+ J+ a) Z) {3 E
  42. /*#define EDMA3_DEBUG*/& O) }! X2 g/ C7 K

  43. # ]$ P4 V% b0 U! K! n; K
  44. #ifdef EDMA3_DEBUG
    $ L1 R" _1 I3 h4 |* d
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)0 ]4 z3 V& e# P9 k# O( A) C9 ?3 D' ]
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__); U& ~4 f- l" a' e: c" I
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)- W- o7 T. @2 e: e* \+ b/ K- W: ~
  48. #else
    ; h* J; D# S5 R* N
  49. #define DMA_PRINTK( x... )" k; a% G- M& M
  50. #define DMA_FN_IN! q% h/ c$ E  x4 s5 L7 A$ v9 Y" y
  51. #define DMA_FN_OUT
    # }; ?  M" {8 h
  52. #endif; l* V8 U* g; ]6 K

  53. 9 _) a* k- I% U) R' Y% z
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)( V/ F- I4 @9 Y; T
  55. #define STATIC_SHIFT                3) V: K( W/ N: ~( Y. n1 p& K
  56. #define TCINTEN_SHIFT               200 W+ }4 h1 R% f0 \9 s# N
  57. #define ITCINTEN_SHIFT              213 r- {) W- B' T+ C. [
  58. #define TCCHEN_SHIFT                22
    2 P9 o) F: q1 I- q4 s
  59. #define ITCCHEN_SHIFT               23" t8 l$ r% E; _! ^; b
  60. - U4 a& i2 a: T4 R. q
  61. static volatile int irqraised1 = 0;: f# k0 Y' b0 X- L
  62. static volatile int irqraised2 = 0;* l2 ~' D8 z3 U1 U: F. {

  63. 2 h' T; k2 R4 @: _$ G1 T
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    $ T  ^9 B# D2 _9 [5 X) S# }0 i$ y
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);# e- X1 r! [9 c$ V# U" r
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);/ L# s" T" f# ]: w6 s2 R

  67. # p: D1 _6 D4 O% v. o( i& \$ o' u& E
  68. dma_addr_t dmaphyssrc1 = 0;/ @) Q8 `0 H# a3 q& ]8 i) w" H
  69. dma_addr_t dmaphyssrc2 = 0;
      k+ U* G0 X$ _3 D
  70. dma_addr_t dmaphysdest1 = 0;, h% X; r$ P8 Y  z
  71. dma_addr_t dmaphysdest2 = 0;" E' _4 \9 z2 q$ ~* O9 E. v0 w
  72. 6 h6 u2 A- c( D) U4 b" v+ s" K
  73. char *dmabufsrc1 = NULL;2 W. ?. {: @- J7 `! a" p* @7 E
  74. char *dmabufsrc2 = NULL;9 T0 Z7 d: ]2 I  b/ v
  75. char *dmabufdest1 = NULL;
    % \  }; _' w9 t* S. F% p3 @
  76. char *dmabufdest2 = NULL;
    8 x* d5 D, W# m, n
  77. % t1 L( S" E9 \$ i* D, v, n. D
  78. static int acnt = 512;* E" J' H4 ^8 u
  79. static int bcnt = 8;
    . F  y% V0 F/ l. f: b7 B# E
  80. static int ccnt = 8;6 L; z8 A6 l* {9 ^  L
  81. 4 e9 G- u7 Y6 Q* L- j
  82. module_param(acnt, int, S_IRUGO);
    $ J3 J+ y' S$ }) Q, d  P1 `- i
  83. module_param(bcnt, int, S_IRUGO);0 S+ y% l3 ]. ^0 i' p1 a
  84. module_param(ccnt, int, S_IRUGO);
复制代码
, N' }3 b& U! a: [$ N/ G! q2 m

1 D6 o1 R9 s9 l      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
% k  j& r: {9 F  P  jarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。1 E) Y) n- n& }7 [; j- q# i
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
" x7 X7 g+ q2 K5 Q5 l: L3 ]6 S+ K- S2 p% U; w

( E6 N4 Y2 z, j. m
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-11-3 04:32 , Processed in 0.040172 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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