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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
" o) @/ F1 d- v0 E
  1. [code]EDMA sample test application( [' {! z2 c+ Q( y* r" }, \
  2. /*
    # [6 F4 `4 x% m
  3. * edma_test.c; T# b2 ~9 V9 B9 \# Q: T8 \
  4. *
    & J1 r8 N5 Z) B" A- c0 n2 `
  5. * brief  EDMA3 Test Application. [. A; U+ ]% _- p" Y" {
  6. *
    2 T  J+ C0 t4 a2 O# W& ^+ D3 ]
  7. *   This file contains EDMA3 Test code.) n$ ~/ V. |* s. M1 e
  8. *
    5 C$ H) e$ t3 l" Q
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE. M# f% C; |5 P& v$ D5 ?
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    # ?1 Y3 s- j1 A, L8 T
  11. *         TO CHANGE.$ d& K, ?: U( B0 w" |0 I
  12. *
    - ^9 ?% r4 A, q* \. n. Z9 W
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    - s$ d, R$ w4 ?* T! O0 w: N4 ?
  14. *
      r  F" \7 Z( X# F9 Y% E2 r
  15. * This program is free software; you can redistribute it and/or9 I) V' v$ t/ }! u$ y3 H' j  _
  16. * modify it under the terms of the GNU General Public License as) `, K4 I; b  p2 W4 }% x
  17. * published by the Free Software Foundation version 2.0 U% m" W% R, @: _6 K- E5 G7 D
  18. *
    6 G, @  F) J& H- Z1 n2 S
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    2 }' h1 w6 j7 x6 l4 i% E1 R
  20. * kind, whether express or implied; without even the implied warranty4 y( J. w3 S/ k" K. Z2 d
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    # v, f& O* e+ x- x1 a9 K+ z
  22. * GNU General Public License for more details.+ ?% s/ a2 _% v# O8 L
  23. */  T" Z1 X( [7 u! q  P  a
  24. # i+ M. B" y9 R# s5 V
  25. #include <linux/module.h>" Q: I6 d! `: V
  26. #include <linux/init.h>
    % _: g% h, i& p8 @4 {
  27. #include <linux/errno.h>
    - k. I& X+ }7 k% g
  28. #include <linux/types.h>! P! [# Y: R2 T9 V* c- `
  29. #include <linux/interrupt.h>+ Z, W; E0 g9 {6 D$ ]5 B
  30. #include <asm/io.h>8 ]! I5 r3 u) ^% q
  31. #include <linux/moduleparam.h>  W, u" r/ d- A1 Y, k) j/ r
  32. #include <linux/sysctl.h>
    # k' U3 r+ _8 x% u- l' ?
  33. #include <linux/mm.h>
    - {( J: Z' k) M
  34. #include <linux/dma-mapping.h>5 h  M. w8 {5 `/ z; k

  35. . H' d, S0 M2 [) M- U3 m
  36. #include <mach/memory.h>9 I* ~* S4 g0 _. Y2 p8 I' X
  37. #include <mach/hardware.h>
    4 G- p( V+ g1 h$ r: h5 \) h. ~
  38. #include <mach/irqs.h>
    9 i8 @. a% J) T* a* R1 O# O# M
  39. #include <asm/hardware/edma.h>/ ^/ h% s( I& s6 R% P3 \5 U* b

  40. . a" b' K2 C. Y5 z% B& G+ S
  41. #undef EDMA3_DEBUG
    7 t  H; R0 V& q( p! `" l1 {
  42. /*#define EDMA3_DEBUG*/! O3 T+ w; X" a8 U& ?4 L
  43. 3 x+ Y' w+ c6 O
  44. #ifdef EDMA3_DEBUG
    / T# I. C! v' W
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS): G* h* p$ S. z% j. Z7 v* H
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    5 ]! v3 O3 l) F7 H4 q# @
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__): Y1 K" L% M; p, d/ r0 F# o3 P
  48. #else
    - q5 u) F) l) W# a$ `, B
  49. #define DMA_PRINTK( x... )
    1 R4 i* Q4 H' @5 Y" G% W
  50. #define DMA_FN_IN
    5 Q2 I; D! v3 A4 N
  51. #define DMA_FN_OUT
    : c" u3 u9 x1 l; c% [/ O+ l* c
  52. #endif! V$ q' C7 k9 H" {

  53. + s# W5 x7 {; f2 z7 v
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)9 V: S# v* c" L; d
  55. #define STATIC_SHIFT                3
    ) N* d7 Z4 U& L( ]
  56. #define TCINTEN_SHIFT               20" v/ r& F$ t' }/ Z
  57. #define ITCINTEN_SHIFT              21
    " j3 L  |  M8 o8 ~( J' k% O
  58. #define TCCHEN_SHIFT                22
    6 ^+ a# F) D' f6 v2 S' T' T, _
  59. #define ITCCHEN_SHIFT               23
    ( P2 `# o. @" |& j
  60. 3 n) e( l8 @4 L- F( a) {  G
  61. static volatile int irqraised1 = 0;, Z4 Y( p. |. E) n5 s
  62. static volatile int irqraised2 = 0;" l: \5 @/ W' @! O
  63. % a% ^, r9 O# Y  ^
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    . S* X8 `5 H" j6 E" {1 M
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    % ~! p* o) x: o( @) n3 I
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);$ u3 I0 h- K( U/ c

  67. # d( l& |, S/ _  u  N/ o" |
  68. dma_addr_t dmaphyssrc1 = 0;' C4 i& Y6 V& C1 j6 Y9 X9 i
  69. dma_addr_t dmaphyssrc2 = 0;& m. z5 i& O- L4 K7 j2 f! h: M( L
  70. dma_addr_t dmaphysdest1 = 0;
    " _$ R1 F7 V/ X$ Q/ H, q
  71. dma_addr_t dmaphysdest2 = 0;
    # m% z6 @0 \/ P* A

  72. ( l; o' ?; r; u* G8 F" A
  73. char *dmabufsrc1 = NULL;
    ' O+ z7 T" M" h! e
  74. char *dmabufsrc2 = NULL;
    ! O' d2 ~# L2 Q% G) a: \
  75. char *dmabufdest1 = NULL;
    3 ~9 Q9 f% D$ r+ w3 j
  76. char *dmabufdest2 = NULL;/ P  {- H6 `7 u, C2 m( i, k, B! l

  77. $ u* \# l2 h5 g  d/ k4 a. c
  78. static int acnt = 512;
    + e0 i- h' i' [5 Q! i# C
  79. static int bcnt = 8;
    ; I% ~6 n0 `8 f8 c9 B% @
  80. static int ccnt = 8;. D8 ?2 [7 S) E/ ]/ l. _% u

  81. ; ^) a6 Z/ z$ p! d
  82. module_param(acnt, int, S_IRUGO);
    8 e0 P2 W: K; {' \
  83. module_param(bcnt, int, S_IRUGO);
      f2 \. H( x: S! e' x
  84. module_param(ccnt, int, S_IRUGO);
复制代码

- j& v0 S% T# d/ F0 Z4 f$ {1 ?- |# W+ d( F
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
3 ^; H) r& C5 U7 L; M; Varm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。% Q" w2 O% r2 L) _3 n  v) v
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。" U, L* Y' K( u7 G0 e( R( P

. v* S( Q# s! Y' q. x3 s- g. }1 j4 l2 G: |* v+ C5 r0 ~5 v' s
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-11-7 06:10 , Processed in 0.039876 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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