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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
8 {) c- t$ F" n$ ~4 n
  1. [code]EDMA sample test application
    5 D  d' j) r2 ?( G, e3 U( M
  2. /*1 |( [4 H* H( n$ F: ^
  3. * edma_test.c
    5 S# }. W2 c8 `; ]( J
  4. *
    ( }5 N6 S; ], m# a/ {
  5. * brief  EDMA3 Test Application; [) s  a$ G% a7 ]% L5 s
  6. *! H+ u) ]: _' o
  7. *   This file contains EDMA3 Test code.
    * k7 p  f4 _) z. S$ F
  8. */ |! n* a, ?( z4 X0 t5 z' n
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE' W3 {% V& I# ?  r" D5 {3 F( l% |* a
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    . }4 o9 t* v1 _# K1 e) t* {, g4 o
  11. *         TO CHANGE.
    ' ?4 x; F' n* o- X- M8 |  N' n
  12. *, r2 U1 \$ b$ t* A% _
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/' b4 r8 n( h9 h; z' l1 v$ `$ C
  14. *0 r8 A8 R1 `& y3 s9 h% X5 i
  15. * This program is free software; you can redistribute it and/or
    5 v# ?: C; z& s& n7 {- E* v
  16. * modify it under the terms of the GNU General Public License as
    : E7 R/ u( h6 M4 U8 D. }, {: m4 n
  17. * published by the Free Software Foundation version 2.
    3 G5 p" ]9 N1 l
  18. *
    % q$ r1 ~  E" G$ U
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any, ^5 w$ l1 c( Q) e* Y# ^
  20. * kind, whether express or implied; without even the implied warranty; \. O1 W) l2 r& H" ^% U7 k
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    8 N0 r; {, Z/ R2 F8 a
  22. * GNU General Public License for more details.) U& [7 I; {4 m/ X- [
  23. */: A) \* ]6 e, t, ~3 K/ a; I/ a
  24. 7 ]/ q, w3 q* X3 R' _' }3 K/ n. c
  25. #include <linux/module.h>
    . O( h8 ]+ a3 p# ?% {/ t5 k
  26. #include <linux/init.h>
    3 m5 U. u' m+ a9 Q8 C) y
  27. #include <linux/errno.h>) z; }$ ]$ ]1 [  E1 \& {4 N) D
  28. #include <linux/types.h>/ O/ ^0 d8 f' h4 N( @" ]
  29. #include <linux/interrupt.h>
    0 g# g0 J+ O+ R8 l1 P( ]$ j: B
  30. #include <asm/io.h>
    , u2 L4 A. q  }$ A+ H( ^/ [) R
  31. #include <linux/moduleparam.h>. ~: ~  k% j" @2 f
  32. #include <linux/sysctl.h>
    / s. |3 J: h" N0 }6 G) p. n+ o, q6 k
  33. #include <linux/mm.h>7 A! b+ [! L9 H
  34. #include <linux/dma-mapping.h>
    1 Z7 h- e* }6 F( C0 m

  35. 5 j/ c$ u  M' [
  36. #include <mach/memory.h>
    ) |4 h/ }% {7 N* m; E1 T4 ]
  37. #include <mach/hardware.h>, O: ]6 H$ F+ W8 u* W
  38. #include <mach/irqs.h>
    0 N" q4 g5 J2 I  h9 q! o
  39. #include <asm/hardware/edma.h>1 C9 c4 B- O, j

  40. 3 K* w  v/ x* i9 L
  41. #undef EDMA3_DEBUG0 Z7 M7 L7 l. Z
  42. /*#define EDMA3_DEBUG*/; V: I, l" D8 ~8 D

  43. ) u" N' q1 ?% i6 E4 \) V
  44. #ifdef EDMA3_DEBUG5 e1 c( q# Y( J7 N# o4 V
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)) G- [# ?% F+ j) l! \, n
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    ( m, t( {$ C$ M3 y5 ~8 j
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    8 p0 v4 s+ l6 m, R0 X
  48. #else
    * I+ k" F* {- B" Q
  49. #define DMA_PRINTK( x... )) e1 @( ?2 o9 T9 Y
  50. #define DMA_FN_IN* C, w# r/ y+ e5 m) U' P
  51. #define DMA_FN_OUT: `" M( g. ^7 x+ x
  52. #endif
    2 `& |* A+ s8 I
  53. : s5 j- S* ]. w4 M# I$ x3 f6 D
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)- Y( N. J1 Z1 O
  55. #define STATIC_SHIFT                3
    " S7 i/ g+ l+ ]( _8 r; C, B
  56. #define TCINTEN_SHIFT               200 ^/ H9 @  G0 P& `8 s, q
  57. #define ITCINTEN_SHIFT              21
    ! ?8 R# O& H9 W: \
  58. #define TCCHEN_SHIFT                221 t. E4 O% ]5 f! d9 o9 _
  59. #define ITCCHEN_SHIFT               23" ~) l+ n! J' A7 E5 M9 ?1 I
  60. 4 ]' U+ Y3 d+ ?" o# @/ F
  61. static volatile int irqraised1 = 0;! a) n7 ^3 f( ]: t# @3 T( i+ G
  62. static volatile int irqraised2 = 0;
    8 v! r$ M: O7 N3 M  X6 z7 V1 i1 w
  63. : \4 G9 b7 O7 a, d4 Z& E
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);8 R, w7 F0 |$ ]' I% J: c
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ( x( o7 g, q' b
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);$ e; M3 q" D9 J0 A4 S$ M
  67. ( [, R7 C; Y  N$ k# X9 u: I  U
  68. dma_addr_t dmaphyssrc1 = 0;
      I$ n. h9 p# A, K% ?
  69. dma_addr_t dmaphyssrc2 = 0;1 y- P% W; p. e( ^7 x6 x! o) ]+ G
  70. dma_addr_t dmaphysdest1 = 0;
    2 Q6 s: E7 o0 r& N6 \! K
  71. dma_addr_t dmaphysdest2 = 0;6 ~0 ~0 b. |' K8 i: A
  72. - x3 r3 A: V+ S) V% l" v/ Y' m. V2 t
  73. char *dmabufsrc1 = NULL;
    $ K" N' E; g& h+ v5 p/ v- E
  74. char *dmabufsrc2 = NULL;
    : Z) L# H% m% |6 `
  75. char *dmabufdest1 = NULL;* n* B8 s$ c/ y
  76. char *dmabufdest2 = NULL;8 m* _$ `% Q0 x8 u7 p: m0 Q; Z
  77. / i/ l  o$ G+ D: S$ g
  78. static int acnt = 512;3 a% h# ]# j- ~
  79. static int bcnt = 8;  D% _* r* W5 K2 h' g8 `( ^2 \0 _
  80. static int ccnt = 8;" Z# R) D. V) T- K: ]' s+ t/ a

  81. 7 {$ k, y- e8 Y' q( B" D  ~( V
  82. module_param(acnt, int, S_IRUGO);
    % \, l8 V. }9 J  [
  83. module_param(bcnt, int, S_IRUGO);2 i+ O1 F7 g$ y7 u4 h! D) d
  84. module_param(ccnt, int, S_IRUGO);
复制代码
; E, w/ o. X/ u* I8 z' {* v
) _/ w- b% p8 H0 ?
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
$ _. D$ P7 t9 M. Oarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
+ @) r( E7 z& e1 N" m9 j     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
, t- E7 `  i9 S$ V+ i) _
0 B1 M( d" Z% U# _/ ~
. ]% k1 F' ?1 R6 K" G
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-7-11 01:48 , Processed in 0.042286 second(s), 28 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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