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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 + \) E6 Z. m! y, Z/ ^
  1. [code]EDMA sample test application
    : T: r4 \" L5 S& M9 J" ?% d
  2. /*/ ]- ^- \* V% Q. q' u
  3. * edma_test.c
      o) C, T4 O8 ?/ w7 ~
  4. *
    4 N% K. v  x5 x4 `8 I6 v
  5. * brief  EDMA3 Test Application  A+ l: u0 {  ]8 D' b6 h  L
  6. *
    6 _5 h9 t+ s* F% A
  7. *   This file contains EDMA3 Test code.4 {8 j: I; i' W3 W( r- {& s
  8. *% h+ R; R. u9 }- k: y  F
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE* I0 k0 X' T. Z- b
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT! {# \! x# @+ y6 O
  11. *         TO CHANGE.
    1 v# r4 }9 d8 n4 g! v4 R
  12. *2 h$ v3 H6 U2 |8 n5 h* n* B  e0 w1 V' E
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    . X  _3 z+ [9 s7 l' r
  14. *: j" S* |6 V+ [3 y
  15. * This program is free software; you can redistribute it and/or5 I/ Z5 j9 x. y
  16. * modify it under the terms of the GNU General Public License as" s: j; g0 e# n' D; V2 {
  17. * published by the Free Software Foundation version 2.; R: h( e; q# @4 y
  18. *
    " _8 b7 K9 U. r8 e- {7 A) W
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    # `5 B4 h+ q( W$ G1 q$ Q- V
  20. * kind, whether express or implied; without even the implied warranty2 d, B4 h. f6 C6 }, H& e
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the/ \4 f" S; l5 b+ Z+ B
  22. * GNU General Public License for more details., l7 ^& ]# L+ V6 t1 ~
  23. */' E" a, u* y9 W% a8 e5 u

  24. 5 h3 u0 M, c* z; E8 ?. ?
  25. #include <linux/module.h>: P" Q- |/ A1 s- p, U$ F/ L
  26. #include <linux/init.h>: `2 E3 z- Z4 G# ?% _( i2 {
  27. #include <linux/errno.h>
    - |# p8 A' ^1 a8 M  b/ f& n6 S
  28. #include <linux/types.h>4 G0 M: ?( F& p9 Z
  29. #include <linux/interrupt.h>
    % V0 l" A2 J3 n7 |+ s
  30. #include <asm/io.h>5 {; p, @1 J: Z+ x; D% j
  31. #include <linux/moduleparam.h>
    - i" v- s2 Z- C& Y
  32. #include <linux/sysctl.h>
    / b8 g( S/ {3 N. B4 }
  33. #include <linux/mm.h>
    * y$ L2 h! Y5 N- H0 e
  34. #include <linux/dma-mapping.h>+ w/ _% I/ ?9 R) D# {

  35. 3 j+ j/ u7 L$ V" M: h2 e
  36. #include <mach/memory.h>
    * H+ J; W0 x* ]4 W# {
  37. #include <mach/hardware.h>
    6 B6 d4 H3 A- e$ H2 ^+ a3 s
  38. #include <mach/irqs.h>
    4 M/ `1 f) ^) N% d  n8 a& f4 \; a' M
  39. #include <asm/hardware/edma.h>3 q" ^' e- r& B- n( \& {5 ~( x
  40. # l! Q1 F; {. B' s
  41. #undef EDMA3_DEBUG
    1 K$ B" w- H' c5 z# ]! _
  42. /*#define EDMA3_DEBUG*/; H- n- D7 I& S0 _4 ]0 l

  43. 7 t! q; Z' v; J! L4 B
  44. #ifdef EDMA3_DEBUG% A  |# h4 _% {6 _
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    ; @9 G4 j& F' ~) ~+ V3 ?
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    ; f) p# G3 H+ }
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)* H: x" ^) {1 q
  48. #else
    / C' [! o$ N  ^5 z, [
  49. #define DMA_PRINTK( x... )
    1 {9 C7 k  _9 N7 W/ `! P; K6 Y4 T
  50. #define DMA_FN_IN
    , Z% \, m8 z3 a5 W3 Y! J% y
  51. #define DMA_FN_OUT( S8 n5 ?$ t* q* D8 Q
  52. #endif
    2 }4 \9 D+ U% L4 S( V2 {  b
  53. 3 R3 E, b, Z! C0 W: M4 q; d& H; T6 Y
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    / x5 j8 J) l7 Y' t2 E
  55. #define STATIC_SHIFT                35 y3 k$ N! G& V- f
  56. #define TCINTEN_SHIFT               208 @) o" f  R5 _# J+ @) `& M1 z% j/ ~  z$ Q
  57. #define ITCINTEN_SHIFT              211 U, u5 e0 g; r! P# u
  58. #define TCCHEN_SHIFT                228 M9 \. H' X* n2 ^* u* c- g9 D
  59. #define ITCCHEN_SHIFT               23
    ( j( i! ~( i" n  o1 c. r2 Y& U

  60. 1 Q7 U' I: p6 ?2 w0 d
  61. static volatile int irqraised1 = 0;6 Q  z6 U; p+ f3 f
  62. static volatile int irqraised2 = 0;
    . ]8 V$ {5 B* i( A+ g

  63. - C0 ~: g2 E: b! M
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);, l$ s! C* S: T, {6 Z; i9 b0 j* e2 f0 ^
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    * O# \; z; K$ F0 f
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    , _1 H* `2 o0 E# e) J; y0 Y' i  {' r2 z
  67. : g# Y. U& b; ?/ p- F/ X
  68. dma_addr_t dmaphyssrc1 = 0;
    / O3 z! v& g" W/ ?8 M1 C1 K
  69. dma_addr_t dmaphyssrc2 = 0;* k) z6 ^7 o, G: I" ~
  70. dma_addr_t dmaphysdest1 = 0;  S9 q" s; d, m4 |9 R' n# O3 v3 q- J
  71. dma_addr_t dmaphysdest2 = 0;' A6 v3 ^. J2 M

  72. , s+ U6 Z# o, ]7 z
  73. char *dmabufsrc1 = NULL;
    ( [% O0 Z3 v' {( H
  74. char *dmabufsrc2 = NULL;
    2 W: N: U* }, o
  75. char *dmabufdest1 = NULL;
    " d; I8 X% d% {( a% M3 E
  76. char *dmabufdest2 = NULL;, E# U: C% E0 L$ n
  77. $ m4 o8 w  y$ ~2 n- V/ k
  78. static int acnt = 512;
    # S* B! B, b2 T
  79. static int bcnt = 8;0 l2 m, z) L; {$ R  C% O# w
  80. static int ccnt = 8;. E! G  e2 E; O% A& M% m
  81. 2 G  K% z2 e" s5 T  P5 `
  82. module_param(acnt, int, S_IRUGO);* m  t+ x( q" y3 M3 i. j/ e
  83. module_param(bcnt, int, S_IRUGO);! v' j" j7 k+ Y  g, f: S' b
  84. module_param(ccnt, int, S_IRUGO);
复制代码
  M8 n5 X0 S% v: u6 c
7 m2 N5 i% E: T3 K8 m
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
: y' n  \9 x0 [6 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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
1 U1 M9 |% D- x0 ]& ]& n: C     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。0 n; ?% ]/ ?, L2 b- D& a7 T
0 v) K/ Y5 ^1 t. d+ B; j8 L

7 b7 p- a4 s8 i5 z) D
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-2-16 03:49 , Processed in 0.038969 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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