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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 7 _3 u, W7 e4 ]
  1. [code]EDMA sample test application
    ' c# m( [; m: P& Q4 K+ x4 m8 W* k% P
  2. /*
    % [2 }+ G  S+ h; ^* ~
  3. * edma_test.c; j) ]2 M. w! I5 K+ x! r% A
  4. *( s0 \* o4 c* d% f; |5 H  a+ f' ^
  5. * brief  EDMA3 Test Application
    6 u9 g0 k, N: w( e/ }; i3 D+ O. E
  6. *8 k) `2 _6 `* |: f8 M! l
  7. *   This file contains EDMA3 Test code.
    ; O  w$ g) O+ m! Q  p5 w7 f2 F
  8. *
    9 O! j" o8 n% [/ L) O
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE* W7 b' v  B. h
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT; J+ O6 m' t+ z: @
  11. *         TO CHANGE.
    3 q8 E/ ~8 b* f9 ^; h
  12. *
    : f( `. y6 G& N1 z( \" f5 j" `8 V( X
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/7 O3 M7 @! D6 B2 G1 ^1 Y6 N! I  P
  14. *
      J4 @, {* \  p' I) P; r
  15. * This program is free software; you can redistribute it and/or. o* y4 r0 p+ ^# C; L- i$ R4 B
  16. * modify it under the terms of the GNU General Public License as
    / G. r# t) v& \
  17. * published by the Free Software Foundation version 2.6 ~$ H% G1 m$ b9 t
  18. *6 L: O# l2 ~# E
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any' V, |9 B3 b, M4 P
  20. * kind, whether express or implied; without even the implied warranty0 b- C& N% x) M$ n% h
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the8 y8 g  _' x" G; I* Y$ M5 ?
  22. * GNU General Public License for more details.5 o  R% A. Q- [1 A7 B
  23. */1 G8 H1 }/ v. u; l6 B
  24. 2 q2 h- D1 U2 J8 j2 r1 t
  25. #include <linux/module.h>
    2 E, p2 ?2 ?+ ?# `; W, K
  26. #include <linux/init.h>
    6 R' {- A4 L+ y; T
  27. #include <linux/errno.h>$ P- N, S3 Z# c! z6 j
  28. #include <linux/types.h>
    ( S( h/ d' A) S& t$ m; C5 F/ I& o- X
  29. #include <linux/interrupt.h>
    9 {6 m; H% ?5 \5 l/ o2 m' p
  30. #include <asm/io.h>0 E5 Y* |: {1 }( T4 X
  31. #include <linux/moduleparam.h>
    , H8 O4 t0 I. P0 z7 o
  32. #include <linux/sysctl.h>9 o/ v9 W) U0 t4 [; ^
  33. #include <linux/mm.h>5 ]2 j1 `- P3 }, V
  34. #include <linux/dma-mapping.h>1 A( @- s" y$ d. A, I; S. z
  35. 2 E7 u* W$ y- ]! K$ l: Z+ K3 a
  36. #include <mach/memory.h>
    1 d- e7 O2 [' t! n( O  w0 A1 s! h
  37. #include <mach/hardware.h>
    ( V7 n: V4 A5 c: {9 b6 ]
  38. #include <mach/irqs.h>
    / g5 |* i- S3 E( w, ^
  39. #include <asm/hardware/edma.h>
    % F* i% {; V8 Z( a. c
  40. % k9 K2 f/ ^4 {% P- ]
  41. #undef EDMA3_DEBUG
    9 S- G0 l/ d: \, E1 B4 k
  42. /*#define EDMA3_DEBUG*/
      r) E  V* Q9 f  o2 o

  43. & s8 k! a" G- I8 U+ g! l; ]# [, x6 G
  44. #ifdef EDMA3_DEBUG
    8 {( N- Z* O$ ?) _& b2 {( k4 v
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    ( Z# F7 k# P! W. T4 d. B
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    ) s- B/ k7 v* B" s3 H
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)* w! G/ G" Q! d. t# d
  48. #else
    1 S) V+ A% a( Z8 Q# D- O# K3 d# }1 W
  49. #define DMA_PRINTK( x... )
    ' G% d" l5 p' K! q
  50. #define DMA_FN_IN
    5 m3 |' a' W  i5 j1 p- z9 f. a
  51. #define DMA_FN_OUT& U$ P  r8 `9 y' i+ t; B' l
  52. #endif
    3 i1 N3 }+ T! a3 ^# L! O

  53. : z3 n  H- S; M$ r- p
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768), Q5 u) {% m& H8 S
  55. #define STATIC_SHIFT                3( F7 V- M; Q; F1 x# a
  56. #define TCINTEN_SHIFT               20
    # o& H: ^/ O0 Q
  57. #define ITCINTEN_SHIFT              21
    ; ]% m/ i( K, k- O/ B% s* @
  58. #define TCCHEN_SHIFT                224 b6 e! e5 n0 ~: w$ M' Z7 t% d' y3 u
  59. #define ITCCHEN_SHIFT               237 b/ Q" I4 ?0 r

  60. 6 b' J0 B8 x. |4 y3 b! G% o$ G
  61. static volatile int irqraised1 = 0;' f& \+ ^1 @! S
  62. static volatile int irqraised2 = 0;% z$ i: r% F) X: {3 D

  63. ( I$ t; t/ j% C6 c. U
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);. ]3 X( a* N( s
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);1 K3 x0 |  U* T: V  y  d
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);3 q, k0 C0 e* g& T  l2 b7 u
  67. . a8 u) R0 B8 Q' k+ J! T1 a+ W
  68. dma_addr_t dmaphyssrc1 = 0;) h, k4 @8 j+ N: w$ W0 O7 T- Z
  69. dma_addr_t dmaphyssrc2 = 0;" c3 N0 K& ^1 V( w" O  S2 l
  70. dma_addr_t dmaphysdest1 = 0;
    ) h' Q; z" ^! b$ Z! ^
  71. dma_addr_t dmaphysdest2 = 0;
    % {. }' c% E6 l8 E) g5 n

  72. # ^3 m* W, F( ~) B  U* g! e8 L9 S
  73. char *dmabufsrc1 = NULL;% O6 d8 C9 k5 e$ J8 g
  74. char *dmabufsrc2 = NULL;- }: ^9 u0 o/ F1 U, E) p' r. s2 v# I
  75. char *dmabufdest1 = NULL;' q* M$ t; }4 @( `& h
  76. char *dmabufdest2 = NULL;  O7 e) P' N+ E2 h$ X3 Q
  77. ; f! `' _" H, z/ J& l8 t1 ^
  78. static int acnt = 512;/ y; W: r9 h! ^, A% N( j$ T, M
  79. static int bcnt = 8;
    / T7 V6 O- P3 p/ }
  80. static int ccnt = 8;
    . w$ i. B8 @+ `/ O

  81. : \( t0 b, T, F; `
  82. module_param(acnt, int, S_IRUGO);3 w2 Z, T. ]% L& I$ u2 \
  83. module_param(bcnt, int, S_IRUGO);! X: }+ h/ G( t( o# B$ U
  84. module_param(ccnt, int, S_IRUGO);
复制代码

) `5 M4 }8 W4 w; a: V  `) a# {6 o6 S
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
! e. q$ |. ~2 narm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
; d; @  l  L# Y- V, X" ~     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。8 p3 k. L# e! u2 C$ t  ]3 M
6 u+ \% Z" h% o. A: q5 a
" n) ^- v3 f! P* e! U! ?; R
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-2-28 18:38 , Processed in 0.039057 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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