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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
/ N4 }2 e8 i% d* W$ n8 w
  1. [code]EDMA sample test application
    5 G& @- H7 r$ _
  2. /*
    / W% b+ ~, f5 R0 J9 G- ]6 B3 r
  3. * edma_test.c
    + T) H& D* z4 I+ a  M: e
  4. *
    2 o* i% C5 V7 I" s2 @: R
  5. * brief  EDMA3 Test Application
    $ Q" y. R" S+ `* R% Y. ]/ q
  6. *
    , O6 R  C; J9 D, I/ X& |2 ^
  7. *   This file contains EDMA3 Test code.
    * V5 ^  I8 D9 x( X
  8. *
      E/ |( {  D& u, y+ b
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    " J! Z4 }9 u! G
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT1 i4 y  \5 o& j" X- q5 V! I& e
  11. *         TO CHANGE.
    # b+ H3 Y. }, ]; D+ W, O
  12. *
    ) @1 ]+ j/ G- u, W: R0 k# d5 R6 W
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/1 L4 ?: |7 g& O! R: e, K4 e
  14. *
    5 l  ]4 R  \- ~! {/ p! {6 S4 L
  15. * This program is free software; you can redistribute it and/or" _# V+ d2 F, f" v
  16. * modify it under the terms of the GNU General Public License as. g6 z5 w& y( N3 I) l! A0 [
  17. * published by the Free Software Foundation version 2.9 L; l; E9 s" V! C, V6 i# }$ p, x
  18. *
    4 ~9 S3 t3 Z0 R
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    1 J+ j- k% s# b/ O
  20. * kind, whether express or implied; without even the implied warranty9 U( v+ ?* A# M( e* Y; i( [
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    ; V5 z: k8 X; b
  22. * GNU General Public License for more details.
    7 n- b) ]- v  r. f) V6 I( r
  23. */
    . H( ]* ]& e+ A! \  Z) O( T4 ]

  24. . d/ o% t$ i9 z
  25. #include <linux/module.h>1 ~1 f! [% u6 c- G9 X2 P) v
  26. #include <linux/init.h>
    . |4 T. `) T& i; D0 j2 R
  27. #include <linux/errno.h>
    2 M3 [' c& K& c. ^2 S
  28. #include <linux/types.h>3 ^6 @% [" i1 H9 p* j( m, G! `* ^
  29. #include <linux/interrupt.h>3 f: q+ ^' ^  }0 g6 b* s
  30. #include <asm/io.h>
    " N& G  A8 u& m% Q8 b8 o
  31. #include <linux/moduleparam.h>
    6 t# B' u: B" F2 ]
  32. #include <linux/sysctl.h>
    ' R% }0 Z/ D+ S% A# T" J1 e- G* u
  33. #include <linux/mm.h># ^  i0 [5 b7 P  T) O
  34. #include <linux/dma-mapping.h>- ~8 X% @( C4 m5 ]3 P) h

  35. . _$ x$ \! i) Z& G" M
  36. #include <mach/memory.h>
    " E/ ]* {$ V& D% Y
  37. #include <mach/hardware.h>9 d0 r7 b0 D1 R' U8 S0 P5 K
  38. #include <mach/irqs.h>
    & O# `9 r* S+ [* y
  39. #include <asm/hardware/edma.h>5 S& g1 N* h0 Z6 R* }; n! c
  40. 3 g8 u* o( N: C2 P/ h
  41. #undef EDMA3_DEBUG
    ; x) q* q# J6 C* o4 T0 T
  42. /*#define EDMA3_DEBUG*/% D3 }/ B5 W" C2 [, d6 t

  43. , p. M# ]4 \, f, d1 ?
  44. #ifdef EDMA3_DEBUG
    % W+ g" z1 G$ p8 i& `
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)3 h/ g$ p! V1 ~" j$ a
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)% m' r; c6 x3 \2 n, ^* x+ s' G" [3 B0 Q
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)& b4 ]8 M6 W+ b
  48. #else
    ! ]# K' w5 F, [' `$ f, G/ H) |/ U
  49. #define DMA_PRINTK( x... )
    ' q3 d. c. i* P. K2 V2 c$ f
  50. #define DMA_FN_IN/ J8 d, v% S, R6 |
  51. #define DMA_FN_OUT
    . K; k+ Q( x( P. D3 y
  52. #endif
    * a  o" {& u- y" D: [

  53. 1 g! \. v# S& A2 k; c, b: F- h% M$ P
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)0 b9 @2 [1 L7 O; ]2 _3 \# s/ ^
  55. #define STATIC_SHIFT                3
    " m) i" I" t' Q  {& g% b; d
  56. #define TCINTEN_SHIFT               20
    ! }% ^) T; v1 E: F% P
  57. #define ITCINTEN_SHIFT              21
    ( z" s* e& D+ N7 x
  58. #define TCCHEN_SHIFT                225 s, S) z- L, G% n6 n( X
  59. #define ITCCHEN_SHIFT               23
    ! P* `% O3 r2 o  F$ S  O8 a' c# `

  60. ( a9 S% V9 i& U$ `
  61. static volatile int irqraised1 = 0;! b. R4 j) ^8 A
  62. static volatile int irqraised2 = 0;
    ! i$ o8 J' C* u6 g
  63. , w. ^$ ^' q3 d! o
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);( l* c% G6 E2 h/ J/ v4 o
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);  E9 e/ A' E& e; _
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);( Y1 x1 K- h/ G' I7 u
  67. . [( {. g6 ~3 j( ]& \2 _9 }9 |
  68. dma_addr_t dmaphyssrc1 = 0;
    ) M, }: r! ~4 g5 L. N
  69. dma_addr_t dmaphyssrc2 = 0;  {( |3 A3 K! l8 H' i+ R6 V
  70. dma_addr_t dmaphysdest1 = 0;/ j$ Z* N) Z/ P1 @+ m6 j
  71. dma_addr_t dmaphysdest2 = 0;
    8 Z% F$ n& |( H  p! B

  72. 4 t. F$ k3 o  E
  73. char *dmabufsrc1 = NULL;7 s4 N" `, ?* U% P  K; m- s2 a
  74. char *dmabufsrc2 = NULL;
    9 C3 F% u. D% n7 l7 f# b# ]9 `1 F+ y
  75. char *dmabufdest1 = NULL;+ Z& f8 `7 s7 @  m; B% [' ^' ^9 \
  76. char *dmabufdest2 = NULL;( B) q$ V  _! n6 K3 q
  77. # ?2 \- {: b9 X
  78. static int acnt = 512;
    % v3 B" m0 ^3 N
  79. static int bcnt = 8;
    , a3 J* l  e9 l7 K8 b4 h9 c
  80. static int ccnt = 8;
    $ D, l# `5 {/ f
  81. / k. \* p& |5 c! V
  82. module_param(acnt, int, S_IRUGO);- `+ u) E/ `/ u9 V  X, R7 f; x
  83. module_param(bcnt, int, S_IRUGO);
    4 `; y0 L0 D; E
  84. module_param(ccnt, int, S_IRUGO);
复制代码
4 Q% t: x6 q3 u; J+ G* i9 s

- i0 a3 G; @% }7 b      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
3 n( C/ `) }( Farm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。' L- ]* ^- O. E& \9 Y# v8 h. O
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
9 w, u4 a& ~1 h% t1 Q, W
! s7 s: V0 ]6 b8 ]" U4 k  P$ N3 |& V3 O& X
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-12-27 23:22 , Processed in 0.036512 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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