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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |正序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
% w" f' `1 s! b
  1. [code]EDMA sample test application  E1 I( E1 P9 U, V5 C, k$ N) M
  2. /*& q+ v' w) m+ w0 J( D
  3. * edma_test.c( T# [/ W2 f1 C. V6 d$ m3 o
  4. *6 E- \( f3 @, r
  5. * brief  EDMA3 Test Application
    ' n6 t& `) V- {5 \% I+ C" I. h
  6. *1 Y3 R7 M7 _# _/ q* n
  7. *   This file contains EDMA3 Test code.' I" _/ W2 T. u' u
  8. *' H" e* ^7 @5 T! N" V" P% Q
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE: a+ s& K1 z5 W$ l; O" t
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    8 F; r; u( s0 S2 A4 U( Q; \1 y8 _
  11. *         TO CHANGE.  u8 y) T  a5 X- R
  12. *
    3 ~; t6 z. j. Y3 U
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/' [( [+ Y# d$ l, g
  14. *" c: A) Y* U0 @, h' V! x
  15. * This program is free software; you can redistribute it and/or
    # f0 n& v$ ], `: P) e
  16. * modify it under the terms of the GNU General Public License as
    # W4 w- F3 `" N
  17. * published by the Free Software Foundation version 2.' j) q! d4 U6 i* |! W* y$ E  ?& M8 ~
  18. *. Y+ x7 N: u2 v6 z! E
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any; t9 N: G, S% [$ C/ h7 |
  20. * kind, whether express or implied; without even the implied warranty
    $ X, \) k2 H5 h( _' C7 l8 x" Q
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the( O$ Z1 ]5 L# j7 ?
  22. * GNU General Public License for more details.9 _! S6 ]' ?' j- a" J) E; H6 f  V6 p
  23. */
    $ L5 S, K" w4 `% r. ~

  24. - h% H# p0 Y; b) H! M. o
  25. #include <linux/module.h>" h* C) w+ \3 A# S$ d
  26. #include <linux/init.h>; b: G0 u! t" }1 G# x
  27. #include <linux/errno.h>
    8 X  D& ?; S, `
  28. #include <linux/types.h>2 K; Y+ O( N$ q# x2 V% V$ Z: v
  29. #include <linux/interrupt.h>
    ! ?7 U: k! j% b- L7 p
  30. #include <asm/io.h>8 ^; l! \- w( b, M  e  H8 T
  31. #include <linux/moduleparam.h>% p9 v+ G( l# j+ U
  32. #include <linux/sysctl.h>/ f* Z, g2 f1 J$ R
  33. #include <linux/mm.h>
    ( m" R0 ]" {) r. x$ ?3 j1 o8 d
  34. #include <linux/dma-mapping.h>
    . u4 z! a4 E$ X, B8 S6 x: _
  35. ' O8 N$ T/ Q$ l  b1 H2 p7 E1 }0 D
  36. #include <mach/memory.h>7 f; D( t* X0 z/ W
  37. #include <mach/hardware.h>8 j. V1 v0 E2 w+ \6 M5 p3 ?4 z9 E0 Z
  38. #include <mach/irqs.h>! s) ~& q0 \  [4 [
  39. #include <asm/hardware/edma.h>- t) n" p) E4 [! N
  40. 5 }% J" M  _0 m/ P5 O$ [
  41. #undef EDMA3_DEBUG
    ' |/ w1 {+ L, f% D6 U. Q& R4 s; Q
  42. /*#define EDMA3_DEBUG*/6 t' k, S2 C- ]  t: }* N- E

  43. . |- o6 W! y" d
  44. #ifdef EDMA3_DEBUG2 n' ?. z) T# g; M) o" l2 ]
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    6 @4 v5 j( {1 \+ v: `* T
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    0 ]  a9 Y% H# N) N6 Z
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
      p. V' t% I/ v/ u4 R
  48. #else
    6 W6 l7 Z" G1 \9 E5 \
  49. #define DMA_PRINTK( x... )1 V; X/ Y: R1 d( S, E3 u
  50. #define DMA_FN_IN
    * O" q. t0 F. t, i/ t2 D
  51. #define DMA_FN_OUT
    : i! n. i  h& z7 Y5 K
  52. #endif
    6 @, d! R+ `9 R3 x
  53. ! y. I1 s5 \7 y9 B
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    + _& O  J4 f+ \
  55. #define STATIC_SHIFT                3
    " |  N, O: s3 b  [
  56. #define TCINTEN_SHIFT               200 ]2 _# a: ^! X
  57. #define ITCINTEN_SHIFT              21
      R0 \, k: K+ z5 B" H5 N
  58. #define TCCHEN_SHIFT                22
    & \: ]! D+ E8 l$ J8 n: F
  59. #define ITCCHEN_SHIFT               238 p- z- C- y% \9 I0 S; B6 f, S

  60. ' S3 y! [$ g- |* d7 O/ O$ Y% a) L$ k
  61. static volatile int irqraised1 = 0;) [$ m* U3 i6 _7 [" r8 r3 \
  62. static volatile int irqraised2 = 0;6 D$ C; s  r9 ^3 m) |
  63. ; F3 d0 X" I: f1 |1 t
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    * J, ~7 C# K( j7 g
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);/ P7 u( q. r. m' u! T; b8 y
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    + \) X. l4 h  F* E# l$ e
  67. 8 J8 d- c/ c4 R- `! w* r6 _
  68. dma_addr_t dmaphyssrc1 = 0;
    / ?5 u  d* R; E! d- M% T
  69. dma_addr_t dmaphyssrc2 = 0;( d* Q7 ^( L3 h; w& O
  70. dma_addr_t dmaphysdest1 = 0;" g& |2 Y5 |/ K( H) g
  71. dma_addr_t dmaphysdest2 = 0;$ W' m0 Z7 T( G0 C& n+ I

  72. * t- k8 Y4 s3 C+ x
  73. char *dmabufsrc1 = NULL;& {' E2 J; @2 P  i; [8 s3 l
  74. char *dmabufsrc2 = NULL;
    # }- |, g- H& l; X& C9 X
  75. char *dmabufdest1 = NULL;
    2 \- ]# Q4 m" l9 @
  76. char *dmabufdest2 = NULL;6 \% X+ ^/ J; |) N& e
  77. . d0 w! T+ R7 T0 e: f) W
  78. static int acnt = 512;
    $ H3 `/ I+ F" ]- Q
  79. static int bcnt = 8;6 |  F6 y! h4 L& B' T: ]
  80. static int ccnt = 8;
    ( J0 T5 ]- N8 m6 U$ }# I2 ]- c
  81. , \# r9 E2 X9 E2 h3 E7 c! z
  82. module_param(acnt, int, S_IRUGO);
    + S: V* o. t" x0 r1 s8 O: M
  83. module_param(bcnt, int, S_IRUGO);' v4 u& H9 b! T+ Y+ L+ ~2 x" b
  84. module_param(ccnt, int, S_IRUGO);
复制代码
5 s8 ^- B( ?* E5 Q

1 |) l) Z9 {8 b) n7 V' v' l( _/ k      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用9 |+ ?5 c9 `" K3 i" A
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。/ @7 D9 R) ~. r: F3 h9 f# U
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
( q% n. x- D, v+ q" t8 P
7 y. L3 B7 Y* [) x+ A; _
9 p# K  A  ^  \- w  W7 v( j
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-2-16 17:14 , Processed in 0.039937 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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