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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 1 {7 O2 h6 U: h  _( {# I0 A. E
  1. [code]EDMA sample test application
    % _7 b1 W1 L& M+ B$ ]4 ^
  2. /*
    " h1 y+ `6 H9 j: B+ f
  3. * edma_test.c
    4 S  n* _  Z3 u; ?/ m: z5 \. k
  4. *! N& g- v! f+ Y% M2 n
  5. * brief  EDMA3 Test Application1 Q: i/ t5 [( ^' P) a% |; l
  6. *
    1 a6 Q0 s( x1 B; u$ ^. x
  7. *   This file contains EDMA3 Test code.
    8 I; L! O0 K7 Y' @8 l; `( f" q
  8. *
    0 `$ D5 H# s1 [4 V5 c8 n
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE* C) R2 o' E0 y" Q. y* H7 f" T3 V
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    * z& R: Q3 K" f, f" [" n5 G
  11. *         TO CHANGE.
    6 n+ t6 _. f( N  q9 g5 k% n# k
  12. *# v- O2 i5 z  P# J
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/. b' n4 J8 d7 [, C4 c" p
  14. *
    0 Q+ f- u" Y, A* @8 S& ?" |1 g" B
  15. * This program is free software; you can redistribute it and/or
    " p: y$ l) U0 v: G4 {/ s
  16. * modify it under the terms of the GNU General Public License as% x6 k4 e& F  N
  17. * published by the Free Software Foundation version 2.# O! U0 h: i  |* @' C* g
  18. *  P6 S6 U" B: w( b% C$ M0 \" A
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any7 }" z" Z9 L% Y
  20. * kind, whether express or implied; without even the implied warranty3 d) u8 @& q  g! i. h% z4 s
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the3 N) s- H  t1 p
  22. * GNU General Public License for more details.
    4 T. k" R& G% ^
  23. */$ o- U5 p2 f$ I4 K% Z1 Q) D- r
  24. " R$ z7 O7 L+ w8 r
  25. #include <linux/module.h>/ \* f* l. f4 J9 v( U$ d4 Z* f) E: H
  26. #include <linux/init.h>2 t( P- b! X$ X$ `- j0 w- \" `
  27. #include <linux/errno.h>, d' ?0 R: R% M8 P6 \! c/ Y
  28. #include <linux/types.h>0 L: |7 u( k0 C, A, e
  29. #include <linux/interrupt.h>' L7 H0 }% v: X  c& }5 b6 P* i& b1 @
  30. #include <asm/io.h>
    + }  P# S% j" U: R; p" [. e
  31. #include <linux/moduleparam.h>6 ?; T  }$ S2 [2 r6 `- h
  32. #include <linux/sysctl.h>
    ' y; K4 l/ A6 h1 j. E  x
  33. #include <linux/mm.h>
    & N* S# A& _$ n1 P, G  `/ ~2 P
  34. #include <linux/dma-mapping.h>$ z) q# c& w; Q$ O1 t3 O
  35. & a" n( F& q. |9 J* J+ ?4 e
  36. #include <mach/memory.h># e  ^' M* j) A/ H
  37. #include <mach/hardware.h>
    0 J& _) `& ]" Z( i; Y" c
  38. #include <mach/irqs.h>. ~+ L. q/ s* e. H: V6 h9 `
  39. #include <asm/hardware/edma.h>
    : g9 w2 J2 T" S: v8 d
  40. ) V3 Y0 i- V) e/ h
  41. #undef EDMA3_DEBUG
    3 z5 T) J( W) U$ A% {5 G
  42. /*#define EDMA3_DEBUG*/7 N' Z/ x4 R! F$ w* D" h$ x
  43. ( o* s0 r* P- P6 |  ~4 E' u
  44. #ifdef EDMA3_DEBUG
    % V. m( H5 z/ `4 A8 H9 b" B. u0 s
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    & C8 v$ G0 c3 H; G
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)9 s' j: f$ g7 w) {
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)& K- D$ @$ }9 Y( x: H
  48. #else
    & M+ U1 V2 }- [$ j# N' z2 l
  49. #define DMA_PRINTK( x... )
    2 K: t, m/ P) b( b; U3 X& e
  50. #define DMA_FN_IN( e( N% ?4 T/ F8 [$ ]) [0 k
  51. #define DMA_FN_OUT8 w' s" V( ?7 @  e8 y5 E
  52. #endif: c( ^5 y) |, J5 l: O  ~. b
  53. $ M0 c4 [6 K1 G
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    ! P, Y0 J6 V+ `
  55. #define STATIC_SHIFT                3
    3 n0 O$ q( o# ^0 Z5 L5 s7 p3 d* w
  56. #define TCINTEN_SHIFT               20
    - a2 l% G# g! V5 }, T$ j7 Y7 Y$ D
  57. #define ITCINTEN_SHIFT              21
    % B; C4 {4 Z" a, g* E9 Z. q, c+ N
  58. #define TCCHEN_SHIFT                22
    $ C5 f, ~( o8 F7 {) F( b
  59. #define ITCCHEN_SHIFT               23/ b  h# p- A+ A6 l

  60. 1 s# E, p( C1 {! W" `# ]5 e
  61. static volatile int irqraised1 = 0;
    : y7 k3 w; T1 T1 A  L
  62. static volatile int irqraised2 = 0;
    ! ?4 k+ k; _* S! A

  63. 6 y# N$ ~: }  n9 o
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    9 o6 f9 I7 T4 R* ^4 t; s
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    : x( @& J; F9 J9 M
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    " y, G1 b* q' `* y! C/ F1 ]8 x7 H
  67. ; f6 |( n: {) b3 ~  ?( p* B
  68. dma_addr_t dmaphyssrc1 = 0;
    , c4 \" b1 b3 p8 v7 h
  69. dma_addr_t dmaphyssrc2 = 0;
    9 W5 @; U0 L/ J/ \6 P# |4 n/ `
  70. dma_addr_t dmaphysdest1 = 0;: a$ B- D2 ?; g: r/ v( {
  71. dma_addr_t dmaphysdest2 = 0;
    3 T8 w$ o' Y& B1 d& `

  72. ) }# q7 g! R* r2 B' K: T* v; y
  73. char *dmabufsrc1 = NULL;' k( Y/ o" n; M5 S1 s7 h1 Q* [
  74. char *dmabufsrc2 = NULL;9 r( a2 E3 E1 w
  75. char *dmabufdest1 = NULL;/ h- b+ P: S" y5 j
  76. char *dmabufdest2 = NULL;
    # j" ~4 H. [" w. x2 M% X
  77. ) p  C  _! }7 ?, N2 V
  78. static int acnt = 512;
    9 D; k  G6 n8 N( {
  79. static int bcnt = 8;0 w  k) t. r  ^# C2 ]
  80. static int ccnt = 8;
    " @! o/ {; N* G8 c7 A- O2 o2 S0 x
  81. 1 o: Z7 t+ B# _/ V5 B7 r; m
  82. module_param(acnt, int, S_IRUGO);
    4 n% q: [: ]( W- ?$ D  S9 S4 ]
  83. module_param(bcnt, int, S_IRUGO);
    0 c5 v4 A$ y! y
  84. module_param(ccnt, int, S_IRUGO);
复制代码
. z: l7 T! N8 h

% e& d( z) \6 v! E4 i6 z/ l      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用) `2 U8 Z: `3 B3 l2 l  X
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。6 i  A- H3 w3 _
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。+ l" n9 n, ~( s) R
: l) f! {9 O$ q( c. [
5 }) Y. I4 m2 I$ {4 {6 Z. `# w3 {/ Y! {
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-8-3 14:02 , Processed in 0.044330 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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