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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 ' k, q$ y0 I$ \4 R6 f
  1. [code]EDMA sample test application
    5 h2 B0 M0 ]! |" X2 k* c, A
  2. /*; S, Q8 N% w# r/ h+ u( S  |' I3 ^
  3. * edma_test.c
    - L, i( p- a' f/ X/ \
  4. *
    3 n/ T' j/ I+ b) {' T$ z$ @
  5. * brief  EDMA3 Test Application' `, j& U5 s9 ~) q8 x6 z
  6. *
    5 M: k! x7 {  T2 ~  r8 ]$ `+ S
  7. *   This file contains EDMA3 Test code.% Y: j8 R, m: \! n0 J% d) G9 b" o
  8. *
    6 d+ |- s9 s0 j2 w
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE$ r+ h8 U# |' z! V! B, X2 P7 {
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    4 ?* }0 }2 [1 k2 V4 d. ~
  11. *         TO CHANGE.+ a' ?8 \& s0 r) ~6 r7 n4 y' W. M6 {
  12. *
    0 k2 D& T8 ^; F2 n
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/3 E; ~! q7 _: J! C% ~
  14. *
    ; ]% T0 ]( [. Z, v) b' B
  15. * This program is free software; you can redistribute it and/or2 N$ {- o5 E5 {' {& q
  16. * modify it under the terms of the GNU General Public License as
    - a1 `+ B6 f$ ]
  17. * published by the Free Software Foundation version 2.
    1 C# Q4 g4 M0 o% N# ~4 m
  18. *' R( S9 M3 d# D5 q
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    ' t0 A; a% x" U- \, R: V3 m
  20. * kind, whether express or implied; without even the implied warranty$ Q2 F1 j- a# v# S: {3 K3 c% T
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
      e+ Q! U& l1 e$ u; C8 o5 N2 r
  22. * GNU General Public License for more details.; j2 v* B1 J1 n
  23. */7 q9 L7 Y5 J: F4 J
  24. - {" @9 o' U; d5 A* Z* D
  25. #include <linux/module.h>9 n8 o! h+ ^7 Q) M5 w3 h
  26. #include <linux/init.h>$ k2 r- V: x8 `+ P) i% _; L0 _
  27. #include <linux/errno.h>5 f5 i4 [# u% [* d
  28. #include <linux/types.h>; }" K5 r5 y, I6 a( S
  29. #include <linux/interrupt.h>
    ; G/ v2 t2 g1 e7 ?3 @' F
  30. #include <asm/io.h>, U/ H0 T+ z1 s7 k, c  v; C: H$ ^, w
  31. #include <linux/moduleparam.h>
    8 B2 S6 n2 C- _
  32. #include <linux/sysctl.h>' [# P7 e' a  x# y7 I9 Q* y& r* W
  33. #include <linux/mm.h>. O2 k- m, p4 v  S* d
  34. #include <linux/dma-mapping.h>
    ' ~( {. o9 ?3 Y6 k# O; `

  35. 3 E: k' Z3 j/ w8 L
  36. #include <mach/memory.h>
    ! |, ]; Z6 K- h% [3 L( V
  37. #include <mach/hardware.h>, [' j# ?" _" R/ s! o5 t0 W! ^
  38. #include <mach/irqs.h>0 \4 J! d. a$ ^9 ]
  39. #include <asm/hardware/edma.h>
    ! e8 t$ g2 J8 `0 @
  40. % P* P, N3 S! u  K2 Q
  41. #undef EDMA3_DEBUG8 \7 N& o4 j+ w# f
  42. /*#define EDMA3_DEBUG*/" t% v. M2 t/ S, B2 {- s
  43. ' e0 Q) H7 [" `- n6 ]% e
  44. #ifdef EDMA3_DEBUG. e- p; e- P! {
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)) N+ J$ ~1 k- d
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)6 f8 g2 }1 b- i/ c+ P' O6 D
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)) H. R- d9 F" C) }1 h: t- G3 V
  48. #else4 O+ U  B# k2 j. f% f
  49. #define DMA_PRINTK( x... )
    1 Y3 x7 R6 L# F
  50. #define DMA_FN_IN; c* k/ ^4 f+ v1 t) H2 b
  51. #define DMA_FN_OUT0 d. i6 J& ]" @8 X1 l7 K! @& H
  52. #endif1 f0 ^. M* {( d; [' ]+ i4 M. R  {

  53. 8 F) f) ^, d' W
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    8 R% j2 J7 j* @; q
  55. #define STATIC_SHIFT                3
    3 }8 k2 S. I4 m2 Q5 p7 s
  56. #define TCINTEN_SHIFT               20  d  B8 R% J5 n% \# D2 Y0 L3 p
  57. #define ITCINTEN_SHIFT              21
    0 r4 |5 H' z, @9 U0 u
  58. #define TCCHEN_SHIFT                22
    - Z, H$ A' P! z; m- b
  59. #define ITCCHEN_SHIFT               23( N: e& o! e& j% H9 `2 j

  60. ! ~, ]7 O9 S; Q' x. G
  61. static volatile int irqraised1 = 0;
    " \" \2 S5 S7 \' ]1 Y- @; ?
  62. static volatile int irqraised2 = 0;
    & m8 e) k1 C' o

  63. / q/ J2 T" O# a' l- O
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);& W! E( I% x" b9 \( V2 ~( P
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    * C# f6 Q7 t4 x/ @- v
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);( J1 @7 Z$ L2 T4 R" ^. y3 p! c$ Y
  67. 6 f  f0 k. F( c; K; s) l4 ]
  68. dma_addr_t dmaphyssrc1 = 0;
    - W" G* k5 K: Q4 e
  69. dma_addr_t dmaphyssrc2 = 0;, I0 @9 [0 h8 S7 R3 h
  70. dma_addr_t dmaphysdest1 = 0;3 c/ D1 P- N6 R* F6 [
  71. dma_addr_t dmaphysdest2 = 0;
    . j. s- b8 r8 i' r. [

  72. & R8 A6 T% Y. u' m: N- ?* ?
  73. char *dmabufsrc1 = NULL;; x- Y/ C3 g3 {2 U' h! s
  74. char *dmabufsrc2 = NULL;
    6 G) p& y3 g8 r0 r' A* L1 e! `9 h
  75. char *dmabufdest1 = NULL;8 e, }! W! C* C  `# z
  76. char *dmabufdest2 = NULL;+ j! E6 D' @; C, V( v# P8 E% z

  77.   J) r: t! u, g- @1 N/ ~
  78. static int acnt = 512;3 ]* o! ]7 T  [4 w; ~
  79. static int bcnt = 8;9 ~2 }" f1 S" M- p4 v$ l4 z* z/ @
  80. static int ccnt = 8;' A4 \% ^; A  ]8 {  [

  81. 4 ?" W- L# p5 D. `
  82. module_param(acnt, int, S_IRUGO);
    - C# r9 T$ P1 s3 e
  83. module_param(bcnt, int, S_IRUGO);! ?3 r4 M  m& C5 D4 b
  84. module_param(ccnt, int, S_IRUGO);
复制代码
: r$ k: l& @! Z6 S! P5 C3 ^

0 j/ k! z# t' Z3 K- }- `, G      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用8 z# p! ~. `2 F, {0 g% g! [
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。" ~) A- J8 K' h. l6 b. P
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。4 z( G& n0 g5 F0 _

& I: {/ R) _# g3 u5 F- P4 g5 x( E( `
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-6-19 15:48 , Processed in 0.044766 second(s), 28 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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