OMAPL138如何在Linux下使用EDMA3驱动 - OMAP-L138 - 嵌入式开发者社区 - 51ele.net
设为首页收藏本站

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
4 d$ x& }# K5 c
  1. [code]EDMA sample test application6 e# H  Z' q% h
  2. /*
    ) ^( _* r# N5 R& R- _9 }4 L+ {/ _
  3. * edma_test.c/ [/ [# j3 W6 d6 ?0 k
  4. *
    7 m. z3 K5 z9 l
  5. * brief  EDMA3 Test Application
      V8 f* K; k1 @& Y2 |3 y
  6. *4 g7 }% H" |; |& H7 D& k7 `, o
  7. *   This file contains EDMA3 Test code.4 w4 }) d9 M7 k6 C% ^3 T/ l
  8. *
      S1 g* {4 [# V/ I3 i6 a9 X
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    2 d' W$ K: x" f' o. J
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    # X4 W4 y9 D3 d1 Z( i5 Y) `
  11. *         TO CHANGE.3 D+ @8 [; d: j
  12. *
    0 @8 h0 z5 m% I/ m4 ^; A* d; R- d" Z
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    . n8 f6 L8 s  Z* [! `3 s
  14. *
    , z8 I( V5 X1 a- f1 n
  15. * This program is free software; you can redistribute it and/or
    0 O8 L' A. ~, n7 D" z6 r) ?
  16. * modify it under the terms of the GNU General Public License as
    0 ^( V* @6 ~* V1 o
  17. * published by the Free Software Foundation version 2.
    # l2 o8 g! Y) \9 D
  18. *
    / K& h, d5 ~( T& V" ]3 ]; G
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    + |& k  B: z" V% [8 `- I
  20. * kind, whether express or implied; without even the implied warranty2 U0 k: e: \3 ^7 Q, K
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    : y- x* G$ t9 [8 g6 f$ I7 c; v
  22. * GNU General Public License for more details.
    ! o. ?/ P  D! @
  23. */9 f9 {) D9 Q- n8 S8 [

  24. # t% G6 u  A, D4 T& y! K0 C3 G
  25. #include <linux/module.h>
    % L( a" [. j& Z/ u$ ^2 E; N
  26. #include <linux/init.h>, }0 t3 i; h+ }+ }7 ]
  27. #include <linux/errno.h>, M! W9 S* i" L( N* E
  28. #include <linux/types.h>& R. c( E: N) B4 {* o; V
  29. #include <linux/interrupt.h>- A7 w; i: \, f; A  \) H- A' Q
  30. #include <asm/io.h>7 K* D( _% I) `
  31. #include <linux/moduleparam.h>9 ]# m6 p; h3 |7 `5 b; A
  32. #include <linux/sysctl.h>' @8 ~: O7 k+ V' W# v$ d
  33. #include <linux/mm.h>. T( C) W( q' Z2 u
  34. #include <linux/dma-mapping.h>+ n8 ^7 [- T! {& H% X
  35. , Z/ e3 Y7 q8 z0 s; h) P# ^1 N$ H" A1 o
  36. #include <mach/memory.h>
    3 ~& P7 V+ o  Q# B
  37. #include <mach/hardware.h>
    : R2 M1 z: C* A& P$ O; N1 R
  38. #include <mach/irqs.h>* e, H7 z. [% c7 n
  39. #include <asm/hardware/edma.h>  t9 e) X% @# c9 _8 l1 ]

  40. ! b  N! B7 N( f3 Y6 D" r: Z
  41. #undef EDMA3_DEBUG
    $ h( E# M" ?& [8 ]
  42. /*#define EDMA3_DEBUG*/
    & P+ t# P$ r  A/ Y7 J3 x

  43. # d( C6 g! o, C4 s* D
  44. #ifdef EDMA3_DEBUG
    3 d+ u! b$ R" c1 q
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)1 @8 ~. v6 e" m2 x( ?
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)- F1 |+ a% l% g
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)) r1 J$ F/ d- |: f
  48. #else
    9 [+ @. m1 r. z; A+ l( k9 |  C
  49. #define DMA_PRINTK( x... )
    3 U  t; Q% v8 b- t
  50. #define DMA_FN_IN
    9 G7 U& g) O( o- L/ P  C( q
  51. #define DMA_FN_OUT) M( y+ M" c2 Z" m  S  @) T* ?
  52. #endif2 K+ Y; d/ `, y6 Z6 c$ T% |
  53. " Q, l, y! k# f! _. M( s) N
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)1 U  ~3 y- H+ U1 x- \$ M3 A
  55. #define STATIC_SHIFT                3, X) i' _! v, O9 {' l* O; u$ r: ?
  56. #define TCINTEN_SHIFT               20
    0 q9 d' R6 [) Z  k
  57. #define ITCINTEN_SHIFT              21
    0 o: s) d: ^" \; d6 g+ n0 h
  58. #define TCCHEN_SHIFT                227 L1 k9 k" S$ U& C! R
  59. #define ITCCHEN_SHIFT               23
    , ~# O# h, Q9 x' A
  60. 8 V  B3 K& M. `+ K* i+ c5 l1 M
  61. static volatile int irqraised1 = 0;
    6 \" Q  H+ O  K! s9 ]
  62. static volatile int irqraised2 = 0;
    1 K9 v' t0 r. b& n- l5 Z+ V

  63. ; W3 V# w) |% K7 n5 w
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);  x1 {3 S% a. ^" L3 U. @" C% q
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ! n6 v; k$ f. z" |$ b- ]
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    & H& l6 d9 e4 w5 X
  67. , n: A6 z% J7 x$ y! {
  68. dma_addr_t dmaphyssrc1 = 0;- C% w) o3 h% E
  69. dma_addr_t dmaphyssrc2 = 0;1 w0 l# `" M* A/ ]( Y+ @
  70. dma_addr_t dmaphysdest1 = 0;
    , j# ?( z+ e! y' O' P7 Q& m, E
  71. dma_addr_t dmaphysdest2 = 0;" j, ^/ R" O2 j! ?

  72. . N$ N  Y: A$ F  [
  73. char *dmabufsrc1 = NULL;/ r9 l" U  Q4 z4 E6 J3 b' ]
  74. char *dmabufsrc2 = NULL;& `8 A$ L# m0 F! d4 r& m$ \. A
  75. char *dmabufdest1 = NULL;
    6 i/ T* w, B9 A; M0 w; o1 e% Y
  76. char *dmabufdest2 = NULL;4 A# X9 F! a$ l! k, v9 r: A& a2 v

  77. $ ~2 p9 [6 A) _  u- ~! s
  78. static int acnt = 512;
    7 \' f3 g; ]2 G  ^
  79. static int bcnt = 8;
    # }) n8 z+ M! Q$ _* b- b& |+ T. ?
  80. static int ccnt = 8;
    - {1 A: v& P6 a  A9 V) x1 K" R
  81. 9 K# G0 M! s* X( D- Y% W
  82. module_param(acnt, int, S_IRUGO);
    9 i0 U( g9 W* Q8 [' O
  83. module_param(bcnt, int, S_IRUGO);
    5 Q1 q, C$ [, f/ h4 a$ ~
  84. module_param(ccnt, int, S_IRUGO);
复制代码

9 q" f( A8 w# Z( E; _2 d
/ z# O" u( v$ v' R# p      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
4 A2 {7 m3 v+ |. Y7 ^% `5 |2 }* marm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。" I) I/ J: x# Z. v
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。' h- w4 |/ P& w2 s! I
; w7 ^; I! ?3 c8 d0 C; K

/ v1 x- R. {. _. i( N& P" k
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2026-1-2 20:44 , Processed in 0.035873 second(s), 24 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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